From 9abdf6a997321a4bc14af38d0a6c15b512ad48b8 Mon Sep 17 00:00:00 2001 From: Thisal Tennakoon Date: Wed, 18 Dec 2024 00:35:21 +0530 Subject: [PATCH] Validate the auth fail massege with the resourceBundle --- .../endpoint/i18n/Resources.properties | 1 + .../endpoint/i18n/Resources_fr_FR.properties | 1 + .../src/main/webapp/domain.jsp | 14 +++++++++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/authentication-portal/src/main/resources/org/wso2/carbon/identity/application/authentication/endpoint/i18n/Resources.properties b/apps/authentication-portal/src/main/resources/org/wso2/carbon/identity/application/authentication/endpoint/i18n/Resources.properties index ae0e2c034f3..fbfcdbf09f4 100644 --- a/apps/authentication-portal/src/main/resources/org/wso2/carbon/identity/application/authentication/endpoint/i18n/Resources.properties +++ b/apps/authentication-portal/src/main/resources/org/wso2/carbon/identity/application/authentication/endpoint/i18n/Resources.properties @@ -311,3 +311,4 @@ error.user.not.found.smsotp=User not found in the directory. Cannot proceed furt authenticate.button=Authenticate please.enter.code=Please enter the code! enter.phone.number=Enter Your Mobile Phone Number +federated.login=Federated Login diff --git a/apps/authentication-portal/src/main/resources/org/wso2/carbon/identity/application/authentication/endpoint/i18n/Resources_fr_FR.properties b/apps/authentication-portal/src/main/resources/org/wso2/carbon/identity/application/authentication/endpoint/i18n/Resources_fr_FR.properties index d12a35c94d1..afe27778769 100644 --- a/apps/authentication-portal/src/main/resources/org/wso2/carbon/identity/application/authentication/endpoint/i18n/Resources_fr_FR.properties +++ b/apps/authentication-portal/src/main/resources/org/wso2/carbon/identity/application/authentication/endpoint/i18n/Resources_fr_FR.properties @@ -271,3 +271,4 @@ error.user.not.found.smsotp=Utilisateur introuvable dans l'annuaire. Impossible authenticate.button=S'uthentifier please.enter.code=Veuillez entrer le code ! enter.phone.number=Entrez votre numéro de téléphone portable +federated.login=Connexion fédérée diff --git a/apps/authentication-portal/src/main/webapp/domain.jsp b/apps/authentication-portal/src/main/webapp/domain.jsp index 09aa18ca01c..d6180a9405b 100644 --- a/apps/authentication-portal/src/main/webapp/domain.jsp +++ b/apps/authentication-portal/src/main/webapp/domain.jsp @@ -27,14 +27,22 @@ <% String domainUnknown = AuthenticationEndpointUtil.i18n(resourceBundle, "domain.unknown"); - String errorMessage = AuthenticationEndpointUtil.i18n(resourceBundle, "authentication.failed"); + String errorMessage = AuthenticationEndpointUtil.i18n(resourceBundle, "authentication.failed.please.retry"); boolean loginFailed = false; if (Boolean.parseBoolean(request.getParameter("authFailure"))) { loginFailed = true; if (request.getParameter("authFailureMsg") != null) { - errorMessage = request.getParameter("authFailureMsg"); + String error = Encode.forJava(request.getParameter("authFailureMsg")); + /* + * Only allowing error messages defined in the resourceBundle. + * AuthenticationEndpointUtil.i18n() will return the value of the provided key if the key is found + * in the resourceBundle. If the key is not found, it will return the key itself. + */ + if (!error.equalsIgnoreCase(AuthenticationEndpointUtil.i18n(resourceBundle, error))) { + errorMessage = AuthenticationEndpointUtil.i18n(resourceBundle, error); + } - if (domainUnknown.equalsIgnoreCase(errorMessage)) { + if (domainUnknown.equalsIgnoreCase(error)) { errorMessage = AuthenticationEndpointUtil.i18n(resourceBundle, "domain.cannot.be.identified"); } }