protected Body getPasswordResetMailingBody(String token, User user, Context ctx) {

    boolean isSecure = getConfiguration().getBoolean(SETTING_KEY_PASSWORD_RESET_LINK_SECURE);
    String url = routes.Signup.resetPassword(token).absoluteURL(ctx.request(), isSecure);

    Lang lang = Lang.preferred(ctx.request().acceptLanguages());
    String langCode = lang.code();

    String html =
        getEmailTemplate(
            "views.html.account.email.password_reset",
            langCode,
            url,
            token,
            user.getName(),
            user.getEmail());
    String text =
        getEmailTemplate(
            "views.txt.account.email.password_reset",
            langCode,
            url,
            token,
            user.getName(),
            user.getEmail());

    return new Body(text, html);
  }
  protected Body getVerifyEmailMailingBodyAfterSignup(String token, User user, Context ctx) {

    boolean isSecure = getConfiguration().getBoolean(SETTING_KEY_VERIFICATION_LINK_SECURE);
    String url = routes.Signup.verify(token).absoluteURL(ctx.request(), isSecure);

    Lang lang = Lang.preferred(ctx.request().acceptLanguages());
    String langCode = lang.code();

    String html =
        getEmailTemplate(
            "views.html.account.email.verify_email",
            langCode,
            url,
            token,
            user.getName(),
            user.getEmail());
    String text =
        getEmailTemplate(
            "views.txt.account.email.verify_email",
            langCode,
            url,
            token,
            user.getName(),
            user.getEmail());

    return new Body(text, html);
  }
Ejemplo n.º 3
0
 /** Returns the current lang. */
 public static play.i18n.Lang lang() {
   return play.i18n.Lang.preferred(Context.current().request().acceptLanguages());
 }