Route [customer.password.request] not defined - php

I am trying to get my development box to work so I can work on a development at home as not to alter and mess up the main site.
I get an error on the development box but not on the main site.
I have set everything up then copied the site via another tutorial. I was able to get all the requirements working and the site works except when I attempt to go to the log in page. I have searched the web for the method used for the route and I cannot find a good explanation of how it works so I can troubleshoot the problem.
div class="col-lg-6 col-md-8 col-sm-8 col-lg-offset-3 col-md-offset-1 col-sm-offset-2">
#if(Session::has('errors'))
<div class="alert alert-danger text-center">
#php ($errors = Session::get('errors'))
#php ($err = $errors->toArray())
{{$err['email'][0]}}
</div>
#endif
<form role="form" id="cust-login-frm" method="POST" action="{{ route('xxx') }}" >
{{csrf_field()}}
<input name="user_type" type="hidden" value="{{ Crypt::encrypt('XX') }}">
<div class="form-group">
<label>Email</label>
<input type="email" id="email" name="email" class="form-control" placeholder="Email" value="{{(Session::has('failed')) ? Session::get('failed') : ''}}">
</div>
<div class="form-group">
<label>Password</label>
<input type="password" id="password" name="password" class="form-control" placeholder="Password">
</div>
<div class="clearfix"></div>
</form>
<div class="form-group col-lg-12 submitbtn">
<!-- <input type="hidden" name="save" value="contact"> -->
<button id="cust-login-btn" class="btn btn-primary" type="button">Sign In</button>
</div>
<center><div> Not Registrated? Register | Forgot Password? </div></center>
The issue I am having is the hyperlink towards the bottom "{{route('customer.password.request') }}" The route before it I can find and follow but this one with the dot notation I cannot. I cannot provide too many details as this is a live site. I suspect this broke due to my command composer update. The main site was not coded by me and has tons of issues. But it will work and its the same. This one is difficult as the main laravel.org does not have much on the subject. If a guru here can point me to a tutorial or page that will help me understand why I am getting the error "Route [customer.password.request] not defined. (View: /var/www/html/resources/views/customer/auth/xxx.blade.php)". Thanks community. :)
NOTE: I have removed some parts to hide real filenames with xxx.

Define the route name in web.php
Route::any('urlname','controllername#functionname')->name('customer.password.request');

Ok the answer to my question here is this.
I found out that the routes were placed in the wrong location.
The morons who did this put the routes in the vender folder file. This was changed when I did an update. So I decided to move them to the web.php and it worked.
So this issue can be closed.
Thanks.

Related

laravel 5.7.15 419 Sorry, your session has expired. Please refresh and try again

Hello i am using laravel 5.7.15
i am facing issue
<form method="post" action="my_post_Action" class="login100-form validate-form">
<input type="hidden" name="_token" value="B6et9cJOP5wNKodCPgCbAafDjpA5EMcRaaJhEJ9F">
<span class="login100-form-title">
Admin Login
</span>
<div class="wrap-input100 validate-input" data-validate="Valid email is required: ex#abc.xyz">
<input class="input100" type="text" name="email" placeholder="Email">
<span class="focus-input100"></span>
<span class="symbol-input100">
<i class="fa fa-envelope" aria-hidden="true"></i>
</span>
</div>
<div class="wrap-input100 validate-input" data-validate="Password is required">
<input class="input100" type="password" name="password" placeholder="Password">
<span class="focus-input100"></span>
<span class="symbol-input100">
<i class="fa fa-lock" aria-hidden="true"></i>
</span>
</div>
<div class="container-login100-form-btn">
<button class="login100-form-btn">
Login
</button>
</div>
</form>
here is my code
i don't know whats error
it my login route if i comment csrf verification form kernal.php then session not work
Any Help thanks in advance ..
Make sure you hard refresh the page; Clear the cache as well by doing:
php artisan cache:clear
Make sure you have the right permissions for your logs folder:
chmod -R 755 storage/logs
Make sure to generate a key for your application:
php artisan key:generate
Check if, when using post and CSRF you have the web middleware group wrapping your routes;
I solved mine with that! Hope it helps! :D
Try to put #csrf in bottom of <form> tag
It's one time only? Just delete the folder storage/framework/cache/data
You have to set chmod to 757 for ./storage/framework/sessions also.
It helps for me and it works fine now, without error 419.
Anytime you define an HTML form in your application, you should include a hidden CSRF token field in the form so that the CSRF protection middleware can validate the request.
Try #csrf after tag.
Just in case of dispair and when no other solution Works , you can add your page name here to a White list to the pages that will not be checked with CSRF.
Needless to say , is a must to remember that with this you are removing this security check , use it wisely and at your own criteria
you can find it here : app/Http/Middleware/VerifyCsrfToken.php
/**
* The URIs that should be excluded from CSRF verification.
*
* #var array
*/
protected $except = [
'/nameofpagetobeexcluded','/anotherpagetobeexcludedfromthischeck'
];
Make sure you have added #csrf OR {{ csrf_field() }} in your form.
<form method="post" action="{{ url('your route here') }}">
#csrf
</form>
i had faced same issue and i solved my issue by adding #csrf inside to form
Like:
<form method="post" action="{{.....}}">
#csrf
.....
</form>
I do not really got the issue I have tried every solution
but i have to install new Laravel and have to move all my Controllers, Routes, And views manually to get rid of the issue Really thanks to all of you guys
:)

Unable to load the "Symfony\Bridge\Twig\Form\TwigRenderer" runtime

I've been working through various hurtles toward migrating an existing Symfony3 web app from a local LAMP host up to Goggle's App Engine Standard PHP Environment. I've taken hints from the appengine-symfony-starter-project to use Memcache for sessions, pre-cache the application code, and connect to a Cloud SQL MySQL database. In have the core pieces working fine.
I added a login form at /login using a TWIG template with a form in it that goes like so:
<form class="form" action="{{ path('security_login') }}" method="post">
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
<div class="form-group">
<input class="form-control" id="email" type="text" name="_email" placeholder="Email" value="{{ last_username }}"/>
</div>
<div class="form-group">
<input class="form-control" id="password" type="password" name="_password" placeholder="Password"/>
</div>
<div class="form-group">
<input type="checkbox" id="remember_me" name="_remember_me" checked>
<label for "remember_me">Remember Me</label>
</div>
<div class="form-group">
<button class="btn btn-round btn-b">Login</button>
</div>
<div class="form-group">Forgot Password?</div>
</form>
This works fine in the local DEV and TEST environments but when I push this up to GAE, I'm getting the error below:
Unable to load the "Symfony\Bridge\Twig\Form\TwigRenderer" runtime.
I've been digging for a couple hours now and haven't found a hit as to what's wrong here. Anyone have any ideas where to look?
Thanks in advance,
In my case "twig.strict_variables: true" to "twig.strict_variables: false" fixed an issue.
We encountered the same error this morning at work, in a Silex app.
This helped us: https://github.com/silexphp/Silex/pull/1571
It worked for us to change in our composer.json the version of symfony/form from ~2.8|^3.0 to ~2.8|3.3 as it appears TwigRenderer is deprecated in 3.4.
Hope this helps.

Add a task to database in laravel then redirect

I am making a simple task app in laravel to cement the basics into my head. I have a page set-up with a form to make a task then submit it to the database, then redirect back to the home page. when I click submit it gives me this screen:
The page has expired due to inactivity.
Please refresh and try again.
my have the project on GitHub here: https://github.com/fullstackfox16/laravel-task
any help would be greatly appreciated!
I found that you forgot to add csrf_token field to your form.
<form method="POST" action="/posts">
<input type="hidden" name="_token" value="{{ csrf_token() }}"> <!-- THIS LINE -->
<div class="field">
<label class="label">Task</label>
<div class="control">
<textarea class="textarea" placeholder="Textarea" name="body"></textarea>
</div>
</div>
<div class="field is-grouped">
<div class="control">
<button class="button is-primary">Add Task</button>
</div>
</div>
</form>
And if the problem persists, clean your browser cache and try again.
Can you more specific in your question. In general when using HTML form you can use redirect back after your request is handle with message bag to show a message feedback to your user, if you have white screen or something else abnormal make sure you don't have error syntax
There are two ways you can work this out:
One, is adding the csrf_field() in your form. nice and easy.
Or
you can omit that route form the VerifyCsrfToken middlaware.
app/Http/Middleware/VerifyCsrfToken.php
protected $except = [
'your/route'
];

Send email with php for wordpress page

I want to create send email form for wordpress page.
WordPress did not allow php But I can use php by using some plugin.
The problem is I did not know how to create it.
I can not make php file separate. Following is my html code.
please help me to write php code.
php should be separate I can insert it at top or bottom of page. but not in separate file
<form action="" method="post">
<div class="form-group">
<label name="first_name">Name:</label>
<input type="text" class="form-control">
</div>
<div class="form-group">
<label name="email">Email:</label>
<input type="email" class="form-control" name="email">
</div>
<div class="form-group">
<label name="subject">Subject:</label>
<input type="text" class="form-control" name="subject">
</div>
<div class="form-group">
<label name="message">Message:</label>
<textarea type="textarea" rows="5" class="form-control" name="message"></textarea>
</div>
<button type="submit" name="submit" class="btn btn-default">Send</button>
</form>
WordPress has a lot of useful plugins for sending mails. I would recommend you to check this: https://pl.wordpress.org/plugins/contact-form-7/
If I'm understanding correctly, you need a contact form to send messages from your WordPress page. Plugin above is very good for things like this and it provides possibility to style your form.

converting web page to pdf in protected members area with pdfmyurl

I'm using the pdfmyurl api to convert web pages to PDF. This works fine for all pages on my website, which are not in the members area. My members area requires a user to log in first.
According to the documentation (http://pdfmyurl.com/html-to-pdf-api#secure) I should be able to pass form fields so their converter can access the page. However when I try this, I still get a PDF of the login page.
My login form (http://members.mysite.com/login.php) has the following HTML:
<form class="form-horizontal" id="memberlogin" action="checkpass.php" method="post">
<div class="control-group">
<label class="control-label" for="user">Username:</label>
<div class="controls">
<input name="user" id="user" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">Password:</label>
<div class="controls">
<input type="password" id="password" name="password" required>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Sign in</button>
</div>
</form>
And in the checkpass.php script I only check for the values of user and password.
I'm using the following API call:
http://pdfmyurl.com/api?license=mylicense&url=http://members.mysite.com/mypage.php&form_url=http://members.site.com/login.php&form_fields[user]=username&form_fields[password]=password
I'm confident the password for the user is correct as I can manually log in. I'm pretty sure this is also how I should pass an array over HTTP GET.
Any ideas?
Your form page is http://members.mysite.com/login.php, but you check the login parameters at http://members.site.com/checkpass.php
I think PDFmyURL will need to pass the login parameters to http://members.site.com/checkpass.php, because that's where you check them.
Try the following API call to do this
http://pdfmyurl.com/api?license=mylicense&url=http://members.mysite.com/mypage.php&form_url=http://members.site.com/checkpass.php&form_fields[user]=username&form_fields[password]=password
Other than this you must check server logs to find problems with authentication.

Categories