refactor: 去除返回提示信息感叹号
This commit is contained in:
@@ -37,36 +37,36 @@ class Login
|
||||
// 校验验证码
|
||||
$code = Cache::get('captcha:token.' . $post['token']);
|
||||
if (!$code) {
|
||||
throw new InvalidLoginException('验证码不存在或已过期!');
|
||||
throw new InvalidLoginException('验证码不存在或已过期');
|
||||
}
|
||||
Cache::delete('captcha:token.' . $post['token']);
|
||||
|
||||
// 校验
|
||||
if (!password_verify($post['captcha'], $code)) {
|
||||
throw new InvalidLoginException('验证码错误!');
|
||||
throw new InvalidLoginException('验证码错误');
|
||||
}
|
||||
|
||||
// 验证用户
|
||||
$user = UserModel::usernameOrMobile($post['username'])->find();
|
||||
if (!$user) {
|
||||
throw new InvalidLoginException('用户不存在!');
|
||||
throw new InvalidLoginException('用户不存在');
|
||||
}
|
||||
|
||||
// 验证密码
|
||||
if ($user['password'] != password_with_salt($post['password'], $user['salt'])) {
|
||||
throw new InvalidLoginException('密码错误!');
|
||||
throw new InvalidLoginException('密码错误');
|
||||
}
|
||||
|
||||
// 验证用户状态
|
||||
if ($user['status'] == -1) {
|
||||
throw new InvalidLoginException('用户已禁用,请联系管理员!');
|
||||
throw new InvalidLoginException('用户已禁用,请联系管理员');
|
||||
}
|
||||
} catch (InvalidLoginException $e) {
|
||||
$msg = $e->getMessage();
|
||||
return error($msg);
|
||||
} catch (\Throwable $th) {
|
||||
$msg = $th->getMessage();
|
||||
return error('登录失败!');
|
||||
return error('登录失败');
|
||||
}
|
||||
|
||||
// 记录登录日志
|
||||
@@ -79,7 +79,7 @@ class Login
|
||||
// 生成 jwt token
|
||||
$token = JWTAuth::builder(['uid' => $user['id']]);
|
||||
|
||||
return success('登录成功!', [
|
||||
return success('登录成功', [
|
||||
'uid' => $user['id'],
|
||||
'nickname' => $user['nickname'],
|
||||
'avatar' => $user['avatar'],
|
||||
|
||||
Reference in New Issue
Block a user