public String register() throws Exception { String flag = INPUT; // && !&&!) if (Common.isEmpty(user.getUsername())) { this.setParameters("username_reg=null&pattern=reg"); } else if (Common.isEmpty(user.getPassword())) { this.setParameters("password_reg=null&pattern=reg"); } else if (Common.isEmpty(user.getEmail())) { this.setParameters("email=null&pattern=reg"); } else if (!this.getExtention().equals(user.getPassword())) { this.setParameters("password=different&pattern=reg"); } else { if (CommonEmail.isEmail(user.getEmail())) { if (userService.getByUserName(user.getUsername()).size() == 0) { if (userService.getByEmail(user.getEmail()).size() == 0) { userService.add(user); } else { this.setParameters("user=existed&pattern=reg"); } } else { this.setParameters("user=existed&pattern=reg"); } } else { this.setParameters("email=incorrect&pattern=reg"); } } return flag; }
public String retrievePwd() throws Exception { String flag = "empty"; if (null != user && !"".equals(user.getEmail())) { List<User> ul = new ArrayList<User>(); ul = userService.getByEmail(user.getEmail()); if (ul.size() > 0) { user = ul.get(0); } if (null != user) { flag = INPUT; getSession().put("email", user.getEmail()); CommonEmail ce = new CommonEmail(); ce.send( null, user.getEmail(), "Retrieve your Password", retrievePasswordContent + Common.generateSecurityCode(4)); } else { this.setParameters("user=nofound"); } } return flag; }