Browse Source

一旦重新登录,此用户所有其他token都失效

lizhen_gitee 3 years ago
parent
commit
e8788134d6
1 changed files with 1 additions and 0 deletions
  1. 1 0
      application/common/library/token/driver/Mysql.php

+ 1 - 0
application/common/library/token/driver/Mysql.php

@@ -55,6 +55,7 @@ class Mysql extends Driver
     {
         $expiretime = !is_null($expire) && $expire !== 0 ? time() + $expire : 0;
         $token = $this->getEncryptedToken($token);
+        $this->handler->where('user_id', $user_id)->delete();
         $this->handler->insert(['token' => $token, 'user_id' => $user_id, 'createtime' => time(), 'expiretime' => $expiretime]);
         return true;
     }