From 9df9b2f5f140aa16fe5f3ca81d0bde64d92a70c5 Mon Sep 17 00:00:00 2001 From: kouxian Date: Wed, 31 Aug 2016 10:18:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=20=E8=B4=A6=E5=8F=B7=E7=99=BB=E9=99=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/rekoe/module/admin/AdminLoginAct.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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");