提交 401d323c 编写于 作者: 冰点.'s avatar 冰点. 提交者: Gitee

捕获异常进行错误信息提示,如果token无效,请重新登录,如果还有问题,可手动清除localStorage中magic-token

上级 ab697154
......@@ -66,10 +66,14 @@ public class SimpleAuthorizationInterceptor implements AuthorizationInterceptor
*/
@Override
public MagicUser getUserByToken(String token) throws MagicLoginException {
String[] userInfo = getUserInfoByToken(token);
MagicUser magicUser = new MagicUser(userInfo[0], userInfo[0], getToken(userInfo[0], userInfo[1]));
if (users.containsKey(magicUser.getUsername()) && users.get(magicUser.getUsername()).equals(userInfo[1])) {
return magicUser;
try {
String[] userInfo = getUserInfoByToken(token);
MagicUser magicUser = new MagicUser(userInfo[0], userInfo[0], getToken(userInfo[0], userInfo[1]));
if (users.containsKey(magicUser.getUsername()) && users.get(magicUser.getUsername()).equals(userInfo[1])) {
return magicUser;
}
} catch (Exception e) {
log.error("token无效,请重新登录,如果还有问题,可手动清除localStorage中magic-token");
}
throw new MagicLoginException("token无效");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册