Skip to content

Commit

Permalink
[enhancement] JCommon MongoDB UserController set default role at login
Browse files Browse the repository at this point in the history
  • Loading branch information
rikaaa0928 committed Jul 2, 2024
1 parent 7ab5014 commit beeae95
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
}
Expand Down

0 comments on commit beeae95

Please sign in to comment.