mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-28 06:47:24 +08:00
feat: php artisan reset:password重置密码增加可自定义密码
This commit is contained in:
@@ -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, '重置失败');
|
||||||
|
|||||||
Reference in New Issue
Block a user