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"; }
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"; } }
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"; }