diff --git a/src/main/java/com/rekoe/module/admin/AdminLoginAct.java b/src/main/java/com/rekoe/module/admin/AdminLoginAct.java index d570805..81bcc5d 100644 --- a/src/main/java/com/rekoe/module/admin/AdminLoginAct.java +++ b/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");