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
sadadw1 authored Jul 2, 2024
2 parents 7ab5014 + beeae95 commit 526464b
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 526464b

Please sign in to comment.