在Laravel框架中重置用户密码 [英] Reset user passwords in Laravel framework
问题描述
我正在尝试根据此实现密码提示: http://laravel.com/docs/4.2/security
I'm trying to implement the password reminder according to this: http://laravel.com/docs/4.2/security
我使用了工匠命令:
php artisan auth:reminders-table
php artisan migrate
并将其添加到我的路线中:
and added this to my routes:
Route::controller('password', 'RemindersController');
Route::get('forgotpassword', 'RemindersController@getRemind');
现在,当我转到此页面时:myapp/forgotpassword
我看到了password.remind
视图
so now when I go to this page : myapp/forgotpassword
I get the password.remind
view
具有以下代码:
<?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"); ?>
当我进入此页面并单击提交表单时,出现一个NotFoundHttpException
错误,如果我将表单中的操作更改为其他功能,也会发生此错误.我的路线是否有问题?或使用我的语法从控制器调用函数?
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
推荐答案
您应更改:
Route::get('forgotpassword', 'RemindersController@getRemind');
进入
Route::post('forgotpassword', 'RemindersController@getRemind');
那是因为您使用POST方法发送表单.
That's because you use POST method to send form.
但是似乎您在GET和POST上都使用了相同的控制器方法,因此在这种情况下您可能需要:
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');
这篇关于在Laravel框架中重置用户密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!