Пример #1
0
  public String login() throws Exception {

    user = new User();
    user.setUsername(userInfo.getUsername());
    user.setPassword(userInfo.getPassword1());
    if (userService.login(user)) {
      session.put("username", user.getUsername());
      session.put("userId", userService.listOne(user.getUsername()).getId());
      return "loginSuccess";
    }
    return "loginFail";
  }
Пример #2
0
 public String register() throws Exception {
   user = new User();
   user.setUsername(userInfo.getUsername());
   user.setAddress(userInfo.getAddress());
   user.setAnswer(userInfo.getAnswer());
   user.setEmail(userInfo.getEmail());
   user.setIdiograph(userInfo.getIdiograph());
   user.setIsOpen(userInfo.getIsopen());
   user.setPassword(userInfo.getPassword1());
   user.setQq(userInfo.getQq());
   user.setQuestion(userInfo.getQuestion());
   user.setRealname(userInfo.getRealname());
   user.setSex(userInfo.getSex());
   user.setBirthday(userInfo.getBirthday());
   if (userService.exist(user)) {
     return "registerFail";
   } else {
     userService.add(user);
     return "registerSuccess";
   }
 }
Пример #3
0
 public String update() {
   user = userService.listOne((String) session.get("username"));
   user.setUsername(userInfo.getUsername());
   user.setAddress(userInfo.getAddress());
   user.setAnswer(userInfo.getAnswer());
   user.setEmail(userInfo.getEmail());
   user.setIdiograph(userInfo.getIdiograph());
   user.setIsOpen(userInfo.getIsopen());
   user.setPassword(userInfo.getPassword1());
   user.setQq(userInfo.getQq());
   user.setQuestion(userInfo.getQuestion());
   user.setRealname(userInfo.getRealname());
   user.setSex(userInfo.getSex());
   user.setBirthday(userInfo.getBirthday());
   userService.update(user);
   session.put("username", user.getUsername());
   return "update";
 }