Skip to content

Commit

Permalink
[Hotfix] Add branding to email link expiry message.
Browse files Browse the repository at this point in the history
  • Loading branch information
savindi7 committed May 20, 2024
1 parent 36d7006 commit 124e123
Show file tree
Hide file tree
Showing 17 changed files with 128 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -264,6 +264,7 @@ export const BrandingPreferencePreview: FunctionComponent<BrandingPreferencePrev
PreviewScreenType.LOGIN,
PreviewScreenType.SIGN_UP,
PreviewScreenType.COMMON,
PreviewScreenType.EMAIL_LINK_EXPIRY,
PreviewScreenType.EMAIL_OTP,
PreviewScreenType.SMS_OTP,
PreviewScreenType.TOTP,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { IdentifiableComponentInterface } from "@wso2is/core/models";
import React, { FunctionComponent, ReactElement } from "react";
import { Placeholder } from "semantic-ui-react";
import { CustomTextPreferenceConstants } from "../../../../constants/custom-text-preference-constants";
import useBrandingPreference from "../../../../hooks/use-branding-preference";

/**
* Proptypes for the email-link-expiry fragment of login screen skeleton.
*/
export type EmailLinkExpiryFragmentInterface = IdentifiableComponentInterface;

/**
* Email link expiry fragment component for the branding preview of Email Link Expiry screen.
*
* @param props - Props injected to the component.
* @returns Email link expiry fragment component.
*/
const EmailLinkExpiryFragment: FunctionComponent<EmailLinkExpiryFragmentInterface> = (
props: EmailLinkExpiryFragmentInterface
): ReactElement => {
const { ["data-componentid"]: componentId } = props;

const { i18n } = useBrandingPreference();

return (
<div data-componentid={ componentId } >
<h2 style={ { color: "#d95858", minHeight: "150px" } } className="mt-5">
{ i18n(CustomTextPreferenceConstants.TEXT_BUNDLE_KEYS.EMAIL_LINK_EXPIRY.MESSAGE,
"This link has expired.") }
</h2>
<Placeholder style={ { animation: "unset", height: "40px" } }>
<Placeholder.Image />
</Placeholder>
<Placeholder style={ { animation: "unset", height: "20px", marginTop: "15px" } }>
<Placeholder.Image />
</Placeholder>
<Placeholder
style={ { animation: "unset", height: "20px", marginBottom: "50px", marginTop: "15px", width: "60%" } }
>
<Placeholder.Image />
</Placeholder>
<button className="ui primary button mb-2">Go Back</button>
</div>
);
};

/**
* Default props for the component.
*/
EmailLinkExpiryFragment.defaultProps = {
"data-componentid": "branding-preview-email-link-expiry-fragment"
};

export default EmailLinkExpiryFragment;
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -78,6 +79,8 @@ const SignInBox: FunctionComponent<SignInBoxInterface> = (
return <PasswordResetFragment />;
} else if (selectedScreen === PreviewScreenType.PASSWORD_RESET_SUCCESS) {
return <PasswordResetSuccessFragment />;
} else if (selectedScreen === PreviewScreenType.EMAIL_LINK_EXPIRY) {
return <EmailLinkExpiryFragment />;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ export class CustomTextPreferenceConstants {

public static readonly TEXT_BUNDLE_KEYS: {
COPYRIGHT: string;
EMAIL_LINK_EXPIRY: {
MESSAGE: string;
};
EMAIL_OTP: {
HEADING: string;
}
Expand Down Expand Up @@ -150,6 +153,9 @@ export class CustomTextPreferenceConstants {
}
} = {
COPYRIGHT: "copyright",
EMAIL_LINK_EXPIRY: {
MESSAGE: "email.link.expiry.message"
},
EMAIL_OTP: {
HEADING: "email.otp.heading"
},
Expand Down
1 change: 1 addition & 0 deletions features/admin.branding.v1/models/branding-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ password.reset.success.body=An email with a password reset link and instructions
password.reset.success.action=Back to application
# <!-- End of Password Reset Success Translations -->

# <!-- Start of Email Link Expiry Translations -->
# EDITABLE=true,SCREEN="email-link-expiry",MULTI_LINE=false
email.link.expiry.message=This link has expired.
# <!-- End of Email Link Expiry Translations -->

Wso2.identity.server=WSO2 Identity Server
All.rights.reserved=All Rights Reserved.
Inc=Inc
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
# <!-- End of Password Reset Success Translations -->

# <!-- Start of Email Link Expiry Translations -->
email.link.expiry.message=Dieser Link ist abgelaufen.
# <!-- End of Email Link Expiry Translations -->

Wso2.identity.server=WSO2 Identity Server
All.rights.reserved=Alle Rechte vorbehalten.
Inc=Inc.
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
# <!-- End of Password Reset Success Translations -->

# <!-- Start of Email Link Expiry Translations -->
email.link.expiry.message=Este enlace ha expirado.
# <!-- End of Email Link Expiry Translations -->

Wso2.identity.server=WSO2 Identity Server
All.rights.reserved=Todos los derechos reservados.
Inc=Inc
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
# <!-- End of Password Reset Success Translations -->

# <!-- Start of Email Link Expiry Translations -->
email.link.expiry.message=Ce lien a expiré
# <!-- End of Email Link Expiry Translations -->

Wso2.identity.server=WSO2 Identity Server
All.rights.reserved=Tous droits réservés.
Inc=Inc
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ password.reset.success.body=パスワードリセットのリンクと手順が
password.reset.success.action=アプリケーションに戻る
# <!-- End of Password Reset Success Translations -->

# <!-- Start of Email Link Expiry Translations -->
email.link.expiry.message=このリンクは有効期限が切れています。
# <!-- End of Email Link Expiry Translations -->

Wso2.identity.server=WSO2 アイデンティティサーバ
All.rights.reserved=無断転載を禁じます。
Inc=Inc
Expand Down Expand Up @@ -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=有効なメールアドレスを入力してください。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
# <!-- End of Password Reset Success Translations -->

# <!-- Start of Email Link Expiry Translations -->
email.link.expiry.message=Este link expirou.
# <!-- End of Email Link Expiry Translations -->

Wso2.identity.server=WSO2 Identity Server
All.rights.reserved=Todos os direitos reservados.
Inc=Inc
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
# <!-- End of Password Reset Success Translations -->

# <!-- Start of Email Link Expiry Translations -->
email.link.expiry.message=Este link expirou.
# <!-- End of Email Link Expiry Translations -->

Wso2.identity.server=WSO2 Identity Server
All.rights.reserved=Todos os direitos reservados.
Inc=Inc
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ password.reset.success.body=带有密码重置链接的电子邮件已发送到
password.reset.success.action=返回应用程序
# <!-- End of Password Reset Success Translations -->

# <!-- Start of Email Link Expiry Translations -->
email.link.expiry.message=此链接已过期。
# <!-- End of Email Link Expiry Translations -->

Wso2.identity.server=WSO2身份服务器
All.rights.reserved=版权所有。
Inc=Inc
Expand Down Expand Up @@ -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=请输入有效的电子邮件地址。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)%>
<% } %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 4 additions & 0 deletions modules/i18n/src/models/namespaces/branding-ns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export interface BrandingNS {
copyright: {
hint: string;
};
"email.link.expiry.message": {
hint: string;
};
"privacy.policy": {
hint: string;
};
Expand Down Expand Up @@ -157,6 +160,7 @@ export interface BrandingNS {
};
screens: {
common: string;
"email-link-expiry": string;
login: string;
"sms-otp": string;
"email-otp": string;
Expand Down
4 changes: 4 additions & 0 deletions modules/i18n/src/translations/en-US/portals/branding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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."
},
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 124e123

Please sign in to comment.