Laravel技巧集锦(24):密码重置功能

版权声明:http://www.itchuan.net https://blog.csdn.net/sinat_37390744/article/details/88743233

准备:

密码重置功能如果无法使用laravel自带的,就可以用sendcloud代替

SendCloud使用 https://blog.csdn.net/sinat_37390744/article/details/88738359

1、找到ForgerPasswordController.php

发现使用了 use SendsPasswordResetEmails;

2、定位找到vendor\laravel\framework\src\Illuminate\Foundation\Auth\SendsPasswordResetEmails.php

发现 $this->broker()->sendResetLink

3、定位找到

4、在User.php中重写sendPasswordResetNotification

public function sendPasswordResetNotification($token)
    {
        $data = [
            'url'=>url('password/reset',$token),
        ];
        $template =new SendCloudTemplate('***',$data);
        \Mail::raw($template,function ($message){
            $message->from('***@****','***');
            $message->to($this->email);
        });
    }

猜你喜欢

转载自blog.csdn.net/sinat_37390744/article/details/88743233