如何在 Laravel 5 中重置密码?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30264985/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to reset passwords in Laravel 5?
提问by Rohan
I am working on a project using Laravel 5 and I am trying to figure out how to reset passwords. I know the migration for the password resets is already there but I remember there was a ReminderController in Laravel 4 which I could generate but I cannot find the same in Laravel 5.
我正在使用 Laravel 5 进行一个项目,我正在尝试弄清楚如何重置密码。我知道密码重置的迁移已经存在,但我记得 Laravel 4 中有一个 ReminderController 可以生成,但我在 Laravel 5 中找不到相同的。
I am sure that Laravel 5 ships with a password reset mechanism but I cannot exactly figure out where to send the request and the method which handles sending the emails?
我确定 Laravel 5 附带密码重置机制,但我无法确切地弄清楚向何处发送请求以及处理发送电子邮件的方法?
I can find the views and the migration but can anyone help me find the controller method and route. If anyone can provide me with a tutorial, I could work with that too.
我可以找到视图和迁移,但任何人都可以帮我找到控制器方法和路由。如果有人可以为我提供教程,我也可以使用它。
采纳答案by Khan Shahrukh
Laravel also includes an
Laravel 还包括一个
Auth\PasswordController?
that contains the logic necessary to reset user passwords. We've even provided views to get you started! The views are located in the
包含重置用户密码所需的逻辑。我们甚至提供了让您入门的视图!这些意见位于
resources/views/auth?
directory. You are free to modify these views as you wish to suit your own application's design.
目录。您可以随意修改这些视图以适合您自己的应用程序设计。
Your user will receive an e-mail with a link that points to the?
您的用户将收到一封电子邮件,其中包含指向?
getReset?method
of the
的
PasswordController.
This method will render the password reset form and allow users to reset their passwords. After the password is reset, the user will automatically be logged into the application and redirected to?/home. You can customize the post-reset redirect location by defining a?redirectTo?property on the PasswordController:
此方法将呈现密码重置表单并允许用户重置他们的密码。密码重置后,用户将自动登录应用程序并重定向到?/home。您可以通过在 PasswordController 上定义一个?redirectTo? 属性来自定义重置后的重定向位置:
protected $redirectTo = '/dashboard';