diff --git a/app/api/logic/LoginLogic.php b/app/api/logic/LoginLogic.php index fc7d5480..05048433 100644 --- a/app/api/logic/LoginLogic.php +++ b/app/api/logic/LoginLogic.php @@ -93,7 +93,11 @@ class LoginLogic extends BaseLogic { try { $where = ['phone' => $params['account']]; - $user = User::field(['id', 'phone', 'avatar', 'nickname'])->where($where)->findOrEmpty(); + $user = User::field(['id', 'phone', 'avatar', 'nickname', 'need_reset'])->where($where)->findOrEmpty(); + if ($user->need_reset == 1) { + self::setError('系统已升级,请重置密码'); + return false; + } //更新登录信息 $user->last_login_time = time(); $user->last_login_ip = request()->ip(); diff --git a/app/api/logic/UserLogic.php b/app/api/logic/UserLogic.php index 4be1707b..5cbd74dc 100644 --- a/app/api/logic/UserLogic.php +++ b/app/api/logic/UserLogic.php @@ -31,6 +31,7 @@ class UserLogic extends BaseLogic $password = create_password($params['password'], $passwordSalt); // 更新 $user->password = $password; + $user->need_reset = 0; $user->save(); return true; } catch (\Exception $e) {