From 124e12371c801e5a2c0aed12498819db4fdcf540 Mon Sep 17 00:00:00 2001 From: savindi7 Date: Mon, 20 May 2024 13:04:15 +0530 Subject: [PATCH] [Hotfix] Add branding to email link expiry message. --- .../preview/branding-preference-preview.tsx | 3 +- .../fragments/email-link-expiry-fragment.tsx | 72 +++++++++++++++++++ .../preview/sign-in-box/sign-in-box.tsx | 3 + .../custom-text-preference-constants.ts | 6 ++ .../models/branding-preferences.ts | 1 + .../endpoint/i18n/Resources.properties | 6 +- .../endpoint/i18n/Resources_de_DE.properties | 5 +- .../endpoint/i18n/Resources_es_ES.properties | 5 +- .../endpoint/i18n/Resources_fr_FR.properties | 5 +- .../endpoint/i18n/Resources_ja_JP.properties | 5 +- .../endpoint/i18n/Resources_pt_BR.properties | 5 +- .../endpoint/i18n/Resources_pt_PT.properties | 5 +- .../endpoint/i18n/Resources_zh_CN.properties | 5 +- .../recovery-portal/src/main/webapp/error.jsp | 4 +- .../webapp/includes/branding-preferences.jsp | 2 +- .../i18n/src/models/namespaces/branding-ns.ts | 4 ++ .../translations/en-US/portals/branding.ts | 4 ++ 17 files changed, 128 insertions(+), 12 deletions(-) create mode 100644 features/admin.branding.v1/components/preview/sign-in-box/fragments/email-link-expiry-fragment.tsx diff --git a/features/admin.branding.v1/components/preview/branding-preference-preview.tsx b/features/admin.branding.v1/components/preview/branding-preference-preview.tsx index d638fd1d603..390dccca38a 100644 --- a/features/admin.branding.v1/components/preview/branding-preference-preview.tsx +++ b/features/admin.branding.v1/components/preview/branding-preference-preview.tsx @@ -42,12 +42,12 @@ import { Placeholder } from "semantic-ui-react"; import { EmailTemplateScreenSkeleton } from "./email-template-screen-skeleton"; import { LoginScreenSkeleton } from "./login-screen-skeleton"; import { MyAccountScreenSkeleton } from "./my-account-screen-skeleton"; +import { AppState } from "../../../admin.core.v1/store"; import { commonConfig } from "../../../admin.extensions.v1/configs"; import { ReactComponent as CustomLayoutSuccessImg } from "../../../themes/wso2is/assets/images/branding/custom-layout-success.svg"; import { ReactComponent as CustomLayoutWarningImg } from "../../../themes/wso2is/assets/images/branding/custom-layout-warning.svg"; -import { AppState } from "../../../admin.core.v1/store"; import { useLayout, useLayoutStyle } from "../../api"; import { usePreviewContent, usePreviewStyle } from "../../api/preview-skeletons"; import { BrandingPreferenceMeta, LAYOUT_DATA, PredefinedLayouts } from "../../meta"; @@ -264,6 +264,7 @@ export const BrandingPreferencePreview: FunctionComponent = ( + props: EmailLinkExpiryFragmentInterface +): ReactElement => { + const { ["data-componentid"]: componentId } = props; + + const { i18n } = useBrandingPreference(); + + return ( +
+

+ { i18n(CustomTextPreferenceConstants.TEXT_BUNDLE_KEYS.EMAIL_LINK_EXPIRY.MESSAGE, + "This link has expired.") } +

+ + + + + + + + + + +
+ ); +}; + +/** + * Default props for the component. + */ +EmailLinkExpiryFragment.defaultProps = { + "data-componentid": "branding-preview-email-link-expiry-fragment" +}; + +export default EmailLinkExpiryFragment; diff --git a/features/admin.branding.v1/components/preview/sign-in-box/sign-in-box.tsx b/features/admin.branding.v1/components/preview/sign-in-box/sign-in-box.tsx index cfe0145d080..dc480328b4c 100644 --- a/features/admin.branding.v1/components/preview/sign-in-box/sign-in-box.tsx +++ b/features/admin.branding.v1/components/preview/sign-in-box/sign-in-box.tsx @@ -23,6 +23,7 @@ import React, { } from "react"; import BasicAuthFragment from "./fragments/basic-auth-fragment"; import CommonFragment from "./fragments/common-fragment"; +import EmailLinkExpiryFragment from "./fragments/email-link-expiry-fragment"; import EmailOTPFragment from "./fragments/email-otp-fragment"; import PasswordRecoveryFragment from "./fragments/password-recovery-fragment"; import PasswordResetFragment from "./fragments/password-reset-fragment"; @@ -78,6 +79,8 @@ const SignInBox: FunctionComponent = ( return ; } else if (selectedScreen === PreviewScreenType.PASSWORD_RESET_SUCCESS) { return ; + } else if (selectedScreen === PreviewScreenType.EMAIL_LINK_EXPIRY) { + return ; } }; diff --git a/features/admin.branding.v1/constants/custom-text-preference-constants.ts b/features/admin.branding.v1/constants/custom-text-preference-constants.ts index dc5a3a6cadf..25ad34f8320 100644 --- a/features/admin.branding.v1/constants/custom-text-preference-constants.ts +++ b/features/admin.branding.v1/constants/custom-text-preference-constants.ts @@ -101,6 +101,9 @@ export class CustomTextPreferenceConstants { public static readonly TEXT_BUNDLE_KEYS: { COPYRIGHT: string; + EMAIL_LINK_EXPIRY: { + MESSAGE: string; + }; EMAIL_OTP: { HEADING: string; } @@ -150,6 +153,9 @@ export class CustomTextPreferenceConstants { } } = { COPYRIGHT: "copyright", + EMAIL_LINK_EXPIRY: { + MESSAGE: "email.link.expiry.message" + }, EMAIL_OTP: { HEADING: "email.otp.heading" }, diff --git a/features/admin.branding.v1/models/branding-preferences.ts b/features/admin.branding.v1/models/branding-preferences.ts index c990fd2bb49..6716d058014 100644 --- a/features/admin.branding.v1/models/branding-preferences.ts +++ b/features/admin.branding.v1/models/branding-preferences.ts @@ -565,6 +565,7 @@ export enum PreviewScreenType { COMMON = "common", LOGIN = "login", MY_ACCOUNT = "myaccount", + EMAIL_LINK_EXPIRY = "email-link-expiry", EMAIL_TEMPLATE = "email-template", SIGN_UP = "sign-up", EMAIL_OTP = "email-otp", diff --git a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources.properties b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources.properties index ea2713751f8..08454c6099e 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources.properties +++ b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources.properties @@ -64,6 +64,11 @@ password.reset.success.body=An email with a password reset link and instructions password.reset.success.action=Back to application # +# +# EDITABLE=true,SCREEN="email-link-expiry",MULTI_LINE=false +email.link.expiry.message=This link has expired. +# + Wso2.identity.server=WSO2 Identity Server All.rights.reserved=All Rights Reserved. Inc=Inc @@ -173,7 +178,6 @@ error=Error Cannot.obtain.username.from.server.response=Cannot obtain username from server response Enter.tenant.domain=Please enter your tenant domain. something.went.wrong.contact.admin=Something went wrong during the recovery process. Please contact identity admin. -Invalid.reset.link=This link has expired. Set.Password=Set Password Continue=Continue Please.enter.valid.email=Please enter a valid email address. diff --git a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_de_DE.properties b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_de_DE.properties index 87f0716ad2d..7dfbf4d971b 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_de_DE.properties +++ b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_de_DE.properties @@ -48,6 +48,10 @@ password.reset.success.body=Ein Link zum Zurücksetzen des Passworts wurde an Ih password.reset.success.action=Zurück zur Registrierung # +# +email.link.expiry.message=Dieser Link ist abgelaufen. +# + Wso2.identity.server=WSO2 Identity Server All.rights.reserved=Alle Rechte vorbehalten. Inc=Inc. @@ -157,7 +161,6 @@ error=Fehler Cannot.obtain.username.from.server.response=Benutzername kann nicht von der Serverantwort abgerufen werden Enter.tenant.domain=Bitte geben Sie Ihre Mieterdomain ein. something.went.wrong.contact.admin=Während des Wiederherstellungsprozesses ging etwas schief. Bitte wenden Sie sich an den Identitätsadministrator -Invalid.reset.link=Dieser Link ist abgelaufen. Set.Password=Passwort erstellen Continue=Weiter Please.enter.valid.email=Bitte geben Sie eine gültige E-Mail-Adresse ein. diff --git a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_es_ES.properties b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_es_ES.properties index 5a2426851f2..bed774fa615 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_es_ES.properties +++ b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_es_ES.properties @@ -48,6 +48,10 @@ password.reset.success.body=Se ha enviado un correo electrónico con un enlace e password.reset.success.action=Volver a la aplicación # +# +email.link.expiry.message=Este enlace ha expirado. +# + Wso2.identity.server=WSO2 Identity Server All.rights.reserved=Todos los derechos reservados. Inc=Inc @@ -157,7 +161,6 @@ error=Error Cannot.obtain.username.from.server.response=No se puede obtener el nombre de usuario de la respuesta del servidor Enter.tenant.domain=Ingrese su dominio de inquilino. something.went.wrong.contact.admin=Algo salió mal durante el proceso de recuperación. Póngase en contacto con Identity Admin. -Invalid.reset.link=Este enlace ha expirado. Set.Password=Configurar la clave Continue=Continuar Please.enter.valid.email=Por favor, introduce una dirección de correo electrónico válida. diff --git a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_fr_FR.properties b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_fr_FR.properties index 878375220da..2c3c31f9591 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_fr_FR.properties +++ b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_fr_FR.properties @@ -48,6 +48,10 @@ password.reset.success.body=Un e-mail avec un lien de réinitialisation de mot d password.reset.success.action=Retour à la candidature # +# +email.link.expiry.message=Ce lien a expiré +# + Wso2.identity.server=WSO2 Identity Server All.rights.reserved=Tous droits réservés. Inc=Inc @@ -150,7 +154,6 @@ business.homepage=http://wso2.com/ name=Nom error=Erreur something.went.wrong.contact.admin=Une erreur s'est produite lors du processus de récupération. Veuillez contacter l administrateur d'identité. -Invalid.reset.link=Ce lien a expiré Set.Password=Définir le mot de passe Continue=Continue need.help.contact.us=Besoin d'aide? Contactez-nous via diff --git a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_ja_JP.properties b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_ja_JP.properties index b6f09f79a3f..6bca31d44ca 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_ja_JP.properties +++ b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_ja_JP.properties @@ -48,6 +48,10 @@ password.reset.success.body=パスワードリセットのリンクと手順が password.reset.success.action=アプリケーションに戻る # +# +email.link.expiry.message=このリンクは有効期限が切れています。 +# + Wso2.identity.server=WSO2 アイデンティティサーバ All.rights.reserved=無断転載を禁じます。 Inc=Inc @@ -153,7 +157,6 @@ error=エラー Cannot.obtain.username.from.server.response=サーバーの応答からユーザー名を取得できません Enter.tenant.domain=テナントドメインを入力してください。 something.went.wrong.contact.admin=認証プロセス中に問題が発生しました。ID管理者までご連絡ください。 -Invalid.reset.link=このリンクは有効期限が切れています。 Set.Password=パスワード設定 Continue=続行 Please.enter.valid.email=有効なメールアドレスを入力してください。 diff --git a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_pt_BR.properties b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_pt_BR.properties index a56fd5061ba..317d0b428de 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_pt_BR.properties +++ b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_pt_BR.properties @@ -48,6 +48,10 @@ password.reset.success.body=Um email com um link de redefinição de senha e ins password.reset.success.action=Voltar ao aplicativo # +# +email.link.expiry.message=Este link expirou. +# + Wso2.identity.server=WSO2 Identity Server All.rights.reserved=Todos os direitos reservados. Inc=Inc @@ -157,7 +161,6 @@ error=Erro Cannot.obtain.username.from.server.response=Não foi possível obter o nome de usuário na resposta do servidor Enter.tenant.domain=Por favor, insira seu domínio de tenant. something.went.wrong.contact.admin=Algo deu errado durante o processo de recuperação. Por favor, entre em contato com seu administrador. -Invalid.reset.link=Este link expirou. Set.Password=Configurar senha Continue=Continuar Please.enter.valid.email=or favor, insira um endereço de e-mail válido. diff --git a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_pt_PT.properties b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_pt_PT.properties index f3950f6a34c..db4122258ec 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_pt_PT.properties +++ b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_pt_PT.properties @@ -48,6 +48,10 @@ password.reset.success.body=Um email com um link de redefinição de senha e ins password.reset.success.action=De volta ao aplicativo # +# +email.link.expiry.message=Este link expirou. +# + Wso2.identity.server=WSO2 Identity Server All.rights.reserved=Todos os direitos reservados. Inc=Inc @@ -157,7 +161,6 @@ error=Erro Cannot.obtain.username.from.server.response=Não pode obter o nome de usuário da resposta do servidor Enter.tenant.domain=Por favor, insira seu domínio de tenant (locatário). something.went.wrong.contact.admin=Algo deu errado durante o processo de recuperação. Entre em contato com a identidade do Admin. -Invalid.reset.link=Este link expirou. Set.Password=Configurar senha Continue=Prosseguir Please.enter.valid.email=Por favor insira um endereço de e-mail válido. diff --git a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_zh_CN.properties b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_zh_CN.properties index 226839e4e5c..c4a60bc5ae4 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_zh_CN.properties +++ b/identity-apps-core/apps/recovery-portal/src/main/resources/org/wso2/carbon/identity/mgt/recovery/endpoint/i18n/Resources_zh_CN.properties @@ -48,6 +48,10 @@ password.reset.success.body=带有密码重置链接的电子邮件已发送到 password.reset.success.action=返回应用程序 # +# +email.link.expiry.message=此链接已过期。 +# + Wso2.identity.server=WSO2身份服务器 All.rights.reserved=版权所有。 Inc=Inc @@ -153,7 +157,6 @@ error=错误 Cannot.obtain.username.from.server.response=无法从服务器响应中获取用户名 Enter.tenant.domain=请输入您的房客域。 something.went.wrong.contact.admin=在身份验证过程中出现了问题。请联系身份管理员。 -Invalid.reset.link=此链接已过期。 Set.Password=设置密码 Continue=继续 Please.enter.valid.email=请输入有效的电子邮件地址。 diff --git a/identity-apps-core/apps/recovery-portal/src/main/webapp/error.jsp b/identity-apps-core/apps/recovery-portal/src/main/webapp/error.jsp index 9beb2de7b97..dd8fe0aa5c6 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/webapp/error.jsp +++ b/identity-apps-core/apps/recovery-portal/src/main/webapp/error.jsp @@ -124,12 +124,12 @@ if (IdentityRecoveryConstants.ErrorMessages.ERROR_CODE_INVALID_CODE.getCode() .equals(errorCode)) { %> - <%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, "Invalid.reset.link")%> + <%=i18n(recoveryResourceBundle, customText, "email.link.expiry.message")%> <% } else if (IdentityRecoveryConstants.ErrorMessages.ERROR_CODE_EXPIRED_CODE.getCode() .equals(errorCode)) { %> - <%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, "Invalid.reset.link")%> + <%=i18n(recoveryResourceBundle, customText, "email.link.expiry.message")%> <% } else { %> <%=IdentityManagementEndpointUtil.i18nBase64(recoveryResourceBundle, errorMsg)%> <% } %> diff --git a/identity-apps-core/apps/recovery-portal/src/main/webapp/includes/branding-preferences.jsp b/identity-apps-core/apps/recovery-portal/src/main/webapp/includes/branding-preferences.jsp index a099ab645fe..94ecc8958bf 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/webapp/includes/branding-preferences.jsp +++ b/identity-apps-core/apps/recovery-portal/src/main/webapp/includes/branding-preferences.jsp @@ -231,7 +231,7 @@ String productWhiteLogoURL = "libs/themes/wso2is/assets/images/branding/logo-full-inverted.svg"; String productWhiteLogoAlt = "WSO2 Identity Server Logo White Variation"; String poweredByLogoURL = ""; - String[] screenNames = {"common", "sign-up", "password-recovery", "password-reset", "password-reset-success"}; + String[] screenNames = {"common", "sign-up", "password-recovery", "password-reset", "password-reset-success", "email-link-expiry"}; // Constants used to create full custom layout name String PREFIX_FOR_CUSTOM_LAYOUT_NAME = "custom"; diff --git a/modules/i18n/src/models/namespaces/branding-ns.ts b/modules/i18n/src/models/namespaces/branding-ns.ts index f4588af5b1e..5adb583e593 100644 --- a/modules/i18n/src/models/namespaces/branding-ns.ts +++ b/modules/i18n/src/models/namespaces/branding-ns.ts @@ -34,6 +34,9 @@ export interface BrandingNS { copyright: { hint: string; }; + "email.link.expiry.message": { + hint: string; + }; "privacy.policy": { hint: string; }; @@ -157,6 +160,7 @@ export interface BrandingNS { }; screens: { common: string; + "email-link-expiry": string; login: string; "sms-otp": string; "email-otp": string; diff --git a/modules/i18n/src/translations/en-US/portals/branding.ts b/modules/i18n/src/translations/en-US/portals/branding.ts index 6b000543f15..42090d841ea 100644 --- a/modules/i18n/src/translations/en-US/portals/branding.ts +++ b/modules/i18n/src/translations/en-US/portals/branding.ts @@ -42,6 +42,9 @@ export const branding: BrandingNS = { copyright: { hint: "Text that appears at the footer of the login screens. You can use `{{currentYear}}` placeholder to automatically display the current year." }, + "email.link.expiry.message": { + hint: "The message that appears when the email link expires. If not set, {{productName}} defaults are used." + }, "privacy.policy": { hint: "The privacy policy text that appears at the footer of the login screens. If not set, {{productName}} defaults are used." }, @@ -157,6 +160,7 @@ export const branding: BrandingNS = { }, screens: { common: "Common", + "email-link-expiry": "Email Link Expiry", "email-otp": "Email OTP", "email-template": "Email Templates", login: "Login",