Esempio n. 1
0
  public static void saveUser(User user, String verifyPassword) {
    // input check
    validation.required(user.email);
    validation.email(user.email);
    validation.min(user.password, 6);
    if (validation.hasErrors()) {
      Logger.info("用户注册输入有错误");
      render("@register");
    }

    // 此邮件是否被注册过
    User userTemp = User.find("byEmailAndDeleted", user.email, false).first();
    if (userTemp != null) {
      flash.error("此邮件己被注册");
      render("@register");
    }

    user.uuid = UUIDUtil.generate();
    user.create();

    Logger.info("register" + user.activated);

    // 放致session中
    session.put("user", user.email);

    // 发送激活邮件
    Mails.activate(user);
    flash.success("己成功注册激活邮件至您邮件中:" + user.email);
    Passport.notactivate(user.email);
  }
Esempio n. 2
0
 /*
  * 신규 가입 사용자 생성
  */
 private static User createNewUser(User user) {
   RandomNumberGenerator rng = new SecureRandomNumberGenerator();
   user.passwordSalt = Arrays.toString(rng.nextBytes().getBytes());
   user.password = hashedPassword(user.password, user.passwordSalt);
   User.create(user);
   if (isUseSignUpConfirm()) {
     user.changeState(UserState.LOCKED);
   } else {
     user.changeState(UserState.ACTIVE);
   }
   Email.deleteOtherInvalidEmails(user.email);
   return user;
 }
Esempio n. 3
0
 /*
  * 신규 가입 사용자 생성
  */
 private static User createNewUser(User user) {
   RandomNumberGenerator rng = new SecureRandomNumberGenerator();
   user.passwordSalt = rng.nextBytes().getBytes().toString();
   user.password = hashedPassword(user.password, user.passwordSalt);
   user.avatarUrl = DEFAULT_AVATAR_URL;
   User.create(user);
   if (isUseSignUpConfirm()) {
     user.changeState(UserState.LOCKED);
   } else {
     user.changeState(UserState.ACTIVE);
   }
   return user;
 }