问题
I'm trying to implement the password reminder according to this: http://laravel.com/docs/4.2/security
I used the artisan commands :
php artisan auth:reminders-table
php artisan migrate
and added this to my routes:
Route::controller('password', 'RemindersController');
Route::get('forgotpassword', 'RemindersController@getRemind');
so now when I go to this page : myapp/forgotpassword
I get the password.remind
view
which has the following code:
<?php include_once(app_path()."/includes/header.php"); ?>
<form action="{{ action('RemindersController@postRemind') }}" method="POST">
<input type="email" name="email">
<input type="submit" value="Send Reminder">
</form>
<?php include_once(app_path()."/includes/footer.php"); ?>
when i get to this page and i click on the submit form i get a NotFoundHttpException
error, this error happens also if i change the action in the form to other functions.. is there something wrong with my routes? or with my syntax for calling a function from a controller?
Thx
回答1:
You should change:
Route::get('forgotpassword', 'RemindersController@getRemind');
into
Route::post('forgotpassword', 'RemindersController@getRemind');
That's because you use POST method to send form.
But it seems you use the same controller method both for GET and POST, so you probably need in this case:
Route::match(['GET','POST'], 'forgotpassword', 'RemindersController@getRemind');
来源:https://stackoverflow.com/questions/26361941/reset-user-passwords-in-laravel-framework