Browse Source

支持管理员 账号登陆

pull/3/head
kouxian 8 years ago
parent
commit
9df9b2f5f1
  1. 12
      src/main/java/com/rekoe/module/admin/AdminLoginAct.java

12
src/main/java/com/rekoe/module/admin/AdminLoginAct.java

@ -57,9 +57,17 @@ public class AdminLoginAct {
Subject subject = SecurityUtils.getSubject();
ThreadContext.bind(subject);
subject.login(token);
Usr usr = usrService.fetch(Cnd.where("usr", "=", "admin"));
User user = (User) subject.getPrincipal();
Usr usr = usrService.fetch(Cnd.where("usr", "=", user.getName()));
if (!Lang.isEmpty(usr)) {
session.setAttribute("usr", usr);
switch (usr.getRole()) {
case admin: {
session.setAttribute("usr", usr);
break;
}
default:
break;
}
}
session.setAttribute(Webs.ME, subject.getPrincipal());
return new ServerRedirectView("/admin/main.rk");

Loading…
Cancel
Save