diff --git a/jcommon/docean-plugin/docean-plugin-mongodb/src/main/java/run/mone/controller/UserController.java b/jcommon/docean-plugin/docean-plugin-mongodb/src/main/java/run/mone/controller/UserController.java index bd8ad309d..86de53110 100644 --- a/jcommon/docean-plugin/docean-plugin-mongodb/src/main/java/run/mone/controller/UserController.java +++ b/jcommon/docean-plugin/docean-plugin-mongodb/src/main/java/run/mone/controller/UserController.java @@ -4,6 +4,7 @@ import com.xiaomi.youpin.docean.anno.ModelAttribute; import com.xiaomi.youpin.docean.anno.RequestMapping; import com.xiaomi.youpin.docean.anno.RequestParam; +import com.xiaomi.youpin.docean.common.StringUtils; import com.xiaomi.youpin.docean.mvc.ContextHolder; import com.xiaomi.youpin.docean.mvc.MvcContext; import run.mone.bo.User; @@ -104,6 +105,9 @@ public String login(User userReq) { return "error"; } user.setPassword(""); + if (StringUtils.isEmpty(user.getRole())) { + user.setRole("user"); + } context.session().setAttribute("user", user); return "ok"; }