From be95646061f3610054bfa8d322fd9f706898a4ee Mon Sep 17 00:00:00 2001 From: jean Date: Tue, 24 Mar 2015 10:49:58 -0300 Subject: [PATCH] KEYCLOAK-1135 add Realm name in email messages --- .../theme/keycloak/email/email-verification.ftl | 2 +- .../keycloak/email/messages/messages_de.properties | 10 +++++----- .../keycloak/email/messages/messages_en.properties | 4 ++-- .../keycloak/email/messages/messages_pt_BR.properties | 4 ++-- .../resources/theme/keycloak/email/password-reset.ftl | 2 +- .../email/freemarker/FreeMarkerEmailProvider.java | 6 ++++++ 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/forms/common-themes/src/main/resources/theme/keycloak/email/email-verification.ftl b/forms/common-themes/src/main/resources/theme/keycloak/email/email-verification.ftl index 5f2490bfed..0ae601f723 100644 --- a/forms/common-themes/src/main/resources/theme/keycloak/email/email-verification.ftl +++ b/forms/common-themes/src/main/resources/theme/keycloak/email/email-verification.ftl @@ -1 +1 @@ -${msg("emailVerificationBody",link, linkExpiration)} \ No newline at end of file +${msg("emailVerificationBody",link, linkExpiration, realmName)} \ No newline at end of file diff --git a/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_de.properties b/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_de.properties index 60228c3472..22cbd1cbe2 100644 --- a/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_de.properties +++ b/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_de.properties @@ -1,12 +1,12 @@ emailVerificationSubject=E-Mail verifizieren -passwordResetSubject=Passwort zurückzusetzen -passwordResetBody=Jemand hat angefordert Ihr Keycloak Passwort zurückzusetzen. Falls das Sie waren, dann klicken Sie auf den folgenden Link um das Passwort zurückzusetzen.\n\n{0}\n\nDieser Link wird in {1} Minuten ablaufen.\n\nFalls Sie das Passwort nicht zurücksetzen möchten, dann können Sie diese E-Mail ignorieren. -emailVerificationBody=Jemand hat ein Keycloak Konto mit dieser E-Mail Adresse erstellt. Fall das Sie waren, dann klicken Sie auf den Link um die E-Mail Adresse zu verifizieren.\n\n{0}\n\nDieser Link wird in {1} Minuten ablaufen.\n\nFalls Sie dieses Konto nicht erstellt haben, dann können sie diese Nachricht ignorieren. +passwordResetSubject=Passwort zur\u00fcckzusetzen +passwordResetBody=Jemand hat angefordert Ihr {2} Passwort zur\u00fcckzusetzen. Falls das Sie waren, dann klicken Sie auf den folgenden Link um das Passwort zur\u00fcckzusetzen.\n\n{0}\n\nDieser Link wird in {1} Minuten ablaufen.\n\nFalls Sie das Passwort nicht zur\u00fccksetzen m\u00f6chten, dann k\u00f6nnen Sie diese E-Mail ignorieren. +emailVerificationBody=Jemand hat ein {2} Konto mit dieser E-Mail Adresse erstellt. Fall das Sie waren, dann klicken Sie auf den Link um die E-Mail Adresse zu verifizieren.\n\n{0}\n\nDieser Link wird in {1} Minuten ablaufen.\n\nFalls Sie dieses Konto nicht erstellt haben, dann k\u00f6nnen sie diese Nachricht ignorieren. eventLoginErrorSubject=Fehlgeschlagene Anmeldung eventLoginErrorBody=Jemand hat um {0} von {1} versucht sich mit ihrem Konto anzumelden. Falls das nicht Sie waren, dann kontaktieren Sie bitte Ihren Admin. eventRemoveTotpSubject=TOTP Entfernt eventRemoveTotpBody=TOTP wurde von ihrem Konto am {0} von {1} entfernt. Falls das nicht Sie waren, dann kontaktieren Sie bitte Ihren Admin. eventUpdatePasswordSubject=Passwort Aktualisiert -eventUpdatePasswordBody=Ihr Passwort wurde am {0} von {1} geändert. Falls das nicht Sie waren, dann kontaktieren Sie bitte Ihren Admin. +eventUpdatePasswordBody=Ihr Passwort wurde am {0} von {1} ge\u00e4ndert. Falls das nicht Sie waren, dann kontaktieren Sie bitte Ihren Admin. eventUpdateTotpSubject=TOTP Aktualisiert -eventUpdateTotpBody=TOTP wurde am {0} von {1} geändert. Falls das nicht Sie waren, dann kontaktieren Sie bitte Ihren Admin. +eventUpdateTotpBody=TOTP wurde am {0} von {1} ge\u00e4ndert. Falls das nicht Sie waren, dann kontaktieren Sie bitte Ihren Admin. diff --git a/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_en.properties b/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_en.properties index c23daf64a6..bb9e88281f 100755 --- a/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_en.properties +++ b/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_en.properties @@ -1,7 +1,7 @@ emailVerificationSubject=Verify email -emailVerificationBody=Someone has created a Keycloak account with this email address. If this was you, click the link below to verify your email address\n\n{0}\n\nThis link will expire within {1} minutes.\n\nIf you didn''t create this account, just ignore this message. +emailVerificationBody=Someone has created a {2} account with this email address. If this was you, click the link below to verify your email address\n\n{0}\n\nThis link will expire within {1} minutes.\n\nIf you didn''t create this account, just ignore this message. passwordResetSubject=Reset password -passwordResetBody=Someone just requested to change your Keycloak account''s password. If this was you, click on the link below to set a new password\n\n{0}\n\nThis link will expire within {1} minutes.\n\nIf you don''t want to reset your password, just ignore this message and nothing will be changed. +passwordResetBody=Someone just requested to change your {2} account''s password. If this was you, click on the link below to set a new password\n\n{0}\n\nThis link will expire within {1} minutes.\n\nIf you don''t want to reset your password, just ignore this message and nothing will be changed. eventLoginErrorSubject=Login error eventLoginErrorBody=A failed login attempt was dettected to your account on {0} from {1}. If this was not you, please contact an admin. eventRemoveTotpSubject=Remove TOTP diff --git a/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_pt_BR.properties b/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_pt_BR.properties index 57a20f1273..e40bdd286c 100644 --- a/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_pt_BR.properties +++ b/forms/common-themes/src/main/resources/theme/keycloak/email/messages/messages_pt_BR.properties @@ -1,7 +1,7 @@ emailVerificationSubject=Verifica\u00e7\u00e3o de e-mail -emailVerificationBody=Algu\u00e9m criou uma conta Keycloak com este endere\u00e7o de e-mail. Se foi voc\u00ea, clique no link abaixo para verificar o seu endere\u00e7o de email\n\n{0}\n\nEste link ir\u00e1 expirar dentro de {1} minutos.\n\nSe n\u00e3o foi voc\u00ea que criou esta conta, basta ignorar esta mensagem. +emailVerificationBody=Algu\u00e9m criou uma conta {2} com este endere\u00e7o de e-mail. Se foi voc\u00ea, clique no link abaixo para verificar o seu endere\u00e7o de email\n\n{0}\n\nEste link ir\u00e1 expirar dentro de {1} minutos.\n\nSe n\u00e3o foi voc\u00ea que criou esta conta, basta ignorar esta mensagem. passwordResetSubject=Redefini\u00e7\u00e3o de senha -passwordResetBody=Algu\u00e9m pediu para mudar a senha de sua conta Keycloak. Se foi voc\u00ea, clique no link abaixo para definir uma nova senha\n\n{0}\n\nEste link ir\u00e1 expirar dentro de {1} minutos.\n\nSe voc\u00ea n\u00e3o deseja redefinir sua senha, basta ignorar esta mensagem e nada ser\u00e1 mudado. +passwordResetBody=Algu\u00e9m pediu para mudar a senha de sua conta {2}. Se foi voc\u00ea, clique no link abaixo para definir uma nova senha\n\n{0}\n\nEste link ir\u00e1 expirar dentro de {1} minutos.\n\nSe voc\u00ea n\u00e3o deseja redefinir sua senha, basta ignorar esta mensagem e nada ser\u00e1 mudado. eventLoginErrorSubject=Erro de login eventLoginErrorBody=Uma tentativa de login mal sucedida para a sua conta foi detectada em {0} de {1}. Se n\u00e3o foi voc\u00ea, por favor, entre em contato com um administrador. eventRemoveTotpSubject=Remover TOTP diff --git a/forms/common-themes/src/main/resources/theme/keycloak/email/password-reset.ftl b/forms/common-themes/src/main/resources/theme/keycloak/email/password-reset.ftl index d7150d61da..aba4fd1941 100644 --- a/forms/common-themes/src/main/resources/theme/keycloak/email/password-reset.ftl +++ b/forms/common-themes/src/main/resources/theme/keycloak/email/password-reset.ftl @@ -1 +1 @@ -${msg("passwordResetBody",link, linkExpiration)} \ No newline at end of file +${msg("passwordResetBody",link, linkExpiration, realmName)} \ No newline at end of file diff --git a/forms/email-freemarker/src/main/java/org/keycloak/email/freemarker/FreeMarkerEmailProvider.java b/forms/email-freemarker/src/main/java/org/keycloak/email/freemarker/FreeMarkerEmailProvider.java index 505a41624c..95f55f3674 100755 --- a/forms/email-freemarker/src/main/java/org/keycloak/email/freemarker/FreeMarkerEmailProvider.java +++ b/forms/email-freemarker/src/main/java/org/keycloak/email/freemarker/FreeMarkerEmailProvider.java @@ -66,6 +66,9 @@ public class FreeMarkerEmailProvider implements EmailProvider { attributes.put("link", link); attributes.put("linkExpiration", expirationInMinutes); + String realmName = realm.getName().substring(0, 1).toUpperCase() + realm.getName().substring(1); + attributes.put("realmName", realmName); + send("passwordResetSubject", "password-reset.ftl", attributes); } @@ -75,6 +78,9 @@ public class FreeMarkerEmailProvider implements EmailProvider { attributes.put("link", link); attributes.put("linkExpiration", expirationInMinutes); + String realmName = realm.getName().substring(0, 1).toUpperCase() + realm.getName().substring(1); + attributes.put("realmName", realmName); + send("emailVerificationSubject", "email-verification.ftl", attributes); }