update: remove hitokoto & add reset admin password

This commit is contained in:
tokumeikoi 2022-03-10 11:31:44 +08:00
parent 8832fde4fa
commit 2eb428fc3c
4 changed files with 55 additions and 9 deletions

View File

@ -0,0 +1,54 @@
<?php
namespace App\Console\Commands;
use App\Models\Plan;
use App\Utils\Helper;
use Illuminate\Console\Command;
use App\Models\User;
use Illuminate\Support\Facades\DB;
class ResetPassword extends Command
{
protected $builder;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'reset:password {email}';
/**
* The console command description.
*
* @var string
*/
protected $description = '重置用户密码';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$user = User::where('email', $this->argument('email'))->first();
if (!$user) abort(500, '邮箱不存在');
$password = Helper::guid(false);
$user->password = password_hash($password, PASSWORD_DEFAULT);
$user->password_algo = null;
if (!$user->save()) abort(500, '重置失败');
$this->info("!!!重置成功!!!");
$this->info("新密码为:{$password},请尽快修改密码。");
}
}

View File

@ -34,11 +34,4 @@ class CommController extends Controller
}
return $suffix;
}
public function getHitokoto()
{
return response([
'data' => Http::get('https://v1.hitokoto.cn/')->json()
]);
}
}

View File

@ -18,7 +18,6 @@ class GuestRoute
$router->match(['get', 'post'], '/payment/notify/{method}/{uuid}', 'Guest\\PaymentController@notify');
// Comm
$router->get ('/comm/config', 'Guest\\CommController@config');
$router->get ('/comm/getHitokoto', 'Guest\\CommController@getHitokoto');
});
}
}

File diff suppressed because one or more lines are too long