mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-02-02 07:28:13 -05:00
feat: php artisan reset:password重置密码增加可自定义密码
This commit is contained in:
parent
bc80d7e91c
commit
ae8cfa40be
@ -16,7 +16,7 @@ class ResetPassword extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'reset:password {email}';
|
protected $signature = 'reset:password {email} {password?}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
@ -42,9 +42,10 @@ class ResetPassword extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
$password = $this->argument('password') ;
|
||||||
$user = User::where('email', $this->argument('email'))->first();
|
$user = User::where('email', $this->argument('email'))->first();
|
||||||
if (!$user) abort(500, '邮箱不存在');
|
if (!$user) abort(500, '邮箱不存在');
|
||||||
$password = Helper::guid(false);
|
$password = $password ?? Helper::guid(false);
|
||||||
$user->password = password_hash($password, PASSWORD_DEFAULT);
|
$user->password = password_hash($password, PASSWORD_DEFAULT);
|
||||||
$user->password_algo = null;
|
$user->password_algo = null;
|
||||||
if (!$user->save()) abort(500, '重置失败');
|
if (!$user->save()) abort(500, '重置失败');
|
||||||
|
Loading…
Reference in New Issue
Block a user