Parcourir la source

客户端-增加将所有用户令牌设置为失效接口

sunxbiao il y a 11 mois
Parent
commit
7e58886773
1 fichiers modifiés avec 2 ajouts et 4 suppressions
  1. 2 4
      app/common/repositories/user/UserRepository.php

+ 2 - 4
app/common/repositories/user/UserRepository.php

@@ -1430,10 +1430,8 @@ class UserRepository extends BaseRepository
1430 1430
     public function checkToken(string $token)
1431 1431
     {
1432 1432
         $has = Cache::has('user_' . $token);
1433
-        if (!$has) {
1434
-            throw new ValidateException('请登录');
1435
-            // throw new AuthException('无效的token');
1436
-        }
1433
+        if (!$has)
1434
+            throw new AuthException('无效的token');
1437 1435
         $lastTime = Cache::get('user_' . $token);
1438 1436
         if (($lastTime + intval(Config::get('admin.token_valid_exp', 15)) * 60) > time())
1439 1437
             throw new AuthException('token 已过期');