예제 #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);
  }
예제 #2
0
 public static void losepwd() {
   Passport.login();
 }