一、错误提示
修改 resources/lang/en/passwords.php
'sent' => '重置密码邮件已成功发送',
'user' => '该邮箱暂未注册',
点击链接重置密码:http://localhost:8000/password/reset
输入一个错误的邮箱
二、重置密码
创建邮件模板
php artisan make:mail ResetPassword
修改生成文件:app/Mail/ResetPassword.php
private $data;
public function __construct($data)
{
$this->data = $data;
}
public function build()
{
return $this->view('email.resetPassword', $this->data);
}
创建文件:resources/views/email/resetPassword.blade.php
点击链接重置密码: {{ $url }}
app/User.php 新增方法
use Mail;
public function sendPasswordResetNotification($token)
{
$data = [
'url' => url('password/reset', $token)
];
Mail::to($this->email)->send(new \App\Mail\ResetPassword($data));
}
点击链接重置密码:http://localhost:8000/password/reset
输入一个正确的邮箱
打开邮箱
复制链接到浏览器重置密码