예제 #1
0
 /** 用户登录 */
 public void login(WebRequest request, WebResponse response) {
   User user = request.parameterToEntity(User.class);
   User sessionUser = userService.checkLogin(user);
   if (CoreUtil.notNull(sessionUser)) {
     WebUtil.sessionAttr(request, SystemConstant.SESSION_CURRENT_USER, sessionUser);
     response.write(SystemConstant.MESSAGE_SUCCESS);
   } else {
     response.write(SystemConstant.MESSAGE_FAILURE);
   }
 }
예제 #2
0
 /** 用户注册 */
 public void register(WebRequest request, WebResponse response) {
   User user = request.parameterToEntity(User.class);
   user.setRegistDt(new Date());
   user.setStatus(SystemConstant.STATUS_AVAILABLE);
   userService.save(user);
 }
예제 #3
0
 /** 检查帐户是否可用 */
 public void accountAvailable(WebRequest request, WebResponse response) {
   User user = new User();
   user.setUsername(request.getParameter("username"));
   response.write(String.valueOf(userService.accountAvailable(user)));
 }