Exemplo n.º 1
0
 public String update() throws Exception {
   HttpServletRequest request = ServletActionContext.getRequest();
   User user =
       new User(
           request.getSession().getAttribute("userName").toString(),
           request.getParameter("oldPassword").toString());
   if (userDao.isLogin(user)) {
     User user2 = new User(request.getSession().getAttribute("userName").toString(), passWord);
     userDao.updateUser(user2);
   } else {
     oprMessage = "原密码错误!";
     return "oprFailed";
   }
   oprMessage = "密码更新成功!";
   return "oprSuccess";
 }
Exemplo n.º 2
0
  public String userLogin() {
    HttpServletRequest request = ServletActionContext.getRequest();
    /*
    if(request.getSession().getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY)==null||!verifyCode.equals(request.getSession().getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY))){
        errorMessage="验证码错误!";
        return "login";
    }*/

    User user = new User(userName, passWord);
    user.setUserRole("admin");
    if (userDao.isLogin(user)) {
      request.getSession().setAttribute("userName", userName);
      return "loginSuccess";
    } else {
      errorMessage = "用户名密码错误!";
      return "login";
    }
  }