mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-02-01 23:18: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
|
||||
*/
|
||||
protected $signature = 'reset:password {email}';
|
||||
protected $signature = 'reset:password {email} {password?}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@ -42,9 +42,10 @@ class ResetPassword extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$password = $this->argument('password') ;
|
||||
$user = User::where('email', $this->argument('email'))->first();
|
||||
if (!$user) abort(500, '邮箱不存在');
|
||||
$password = Helper::guid(false);
|
||||
$password = $password ?? Helper::guid(false);
|
||||
$user->password = password_hash($password, PASSWORD_DEFAULT);
|
||||
$user->password_algo = null;
|
||||
if (!$user->save()) abort(500, '重置失败');
|
||||
|
Loading…
Reference in New Issue
Block a user