Skip to content

Commit

Permalink
Set username labels according to the multi-attribute login config in …
Browse files Browse the repository at this point in the history
…recovery-endpoint
  • Loading branch information
sumedhe committed Sep 2, 2021
1 parent d611373 commit f44c7b8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Recover.password=Recover Password
email.username=Email address
Enter.detail.to.recover.pwd=Enter below details to recover your password
Username=Username
Identifier=Identifier
Recover.with.mail=Recover with Mail
Recover.with.question=Recover with Security Questions
Submit=Submit
Expand Down Expand Up @@ -100,6 +101,7 @@ Need.to.select.all.mandatory.attributes=You need to select all mandatory attribu
Ok=Ok
Start.signing.up=Start Signing Up
Enter.your.username.here=Enter your username here
Enter.your.identifier.here=Enter your identifier here
If.you.specify.tenant.domain.you.registered.under.super.tenant=If you do not specify a tenant domain, you will be registered under super tenant
Proceed.to.self.register=Proceed to Self Register
Confirm.Privacy.Policy=Please confirm that you have read and understood the Privacy Policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Identity.server=Identity Server
Recover.password=Récupérez son mot de passe
Enter.detail.to.recover.pwd=Entrer les détails ci-dessous pour récupérer votre mot de passe
Username=Nom d'utilisateur
Identifier=Identifiant
Recover.with.mail=récupérer avec l'adresse mail
Recover.with.question=récupérer avec les questions de sécurité
Submit=Soumettre
Expand Down Expand Up @@ -97,6 +98,7 @@ Need.to.select.all.mandatory.attributes=Vous devez sélectionner tous les attrib
Ok=Ok
Start.signing.up=Commencer la connexion
Enter.your.username.here=Entrer votre nom d'utilisateur ici
Enter.your.identifier.here=Entrez votre identifiant ici
If.you.specify.tenant.domain.you.registered.under.super.tenant=Si vous ne spécifiez aucun domaine, vous allez être enregistré en tant que hôte
Proceed.to.self.register=Procéder à l'auto-inscription
Confirm.Privacy.Policy=Veuillez confirmer que vous avez lu et compris la politique de confidentialité
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.IdentityManagementEndpointConstants" %>
<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.IdentityManagementEndpointUtil" %>
<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.PreferenceRetrievalClient" %>
<%@ page import="org.wso2.carbon.identity.mgt.endpoint.util.client.PreferenceRetrievalClientException" %>
<%@ page import="org.wso2.carbon.identity.core.util.IdentityTenantUtil" %>

<jsp:directive.include file="includes/localize.jsp"/>
Expand All @@ -35,6 +37,25 @@
if (StringUtils.isBlank(tenantDomain)) {
tenantDomain = IdentityManagementEndpointConstants.SUPER_TENANT;
}
Boolean isMultiAttributeLoginEnabledInTenant = false;
try {
PreferenceRetrievalClient preferenceRetrievalClient = new PreferenceRetrievalClient();
isMultiAttributeLoginEnabledInTenant = preferenceRetrievalClient.checkMultiAttributeLogin(tenantDomain);
} catch (PreferenceRetrievalClientException e) {
request.setAttribute("error", true);
request.setAttribute("errorMsg", IdentityManagementEndpointUtil
.i18n(recoveryResourceBundle, "something.went.wrong.contact.admin"));
IdentityManagementEndpointUtil.addErrorInformation(request, e);
request.getRequestDispatcher("error.jsp").forward(request, response);
}
String usernameLabel = "Username";
String enterUsernameHereText = "Enter.your.username.here";
if (isMultiAttributeLoginEnabledInTenant) {
usernameLabel = "Identifier";
enterUsernameHereText = "Enter.your.identifier.here";
}
%>

<html>
Expand Down Expand Up @@ -84,11 +105,11 @@
</div>
<% } %>
<p>
<%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, "Enter.your.username.here")%>
<%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, enterUsernameHereText)%>
</p>
<div class="field">
<label>
<%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, "Username")%>
<%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, usernameLabel)%>
</label>
<input id="username" name="username" type="text" tabindex="0" required>
<%
Expand Down
11 changes: 9 additions & 2 deletions apps/recovery-portal/src/main/webapp/password-recovery.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,24 @@
Boolean isQuestionBasedPasswordRecoveryEnabledByTenant = false;
Boolean isNotificationBasedPasswordRecoveryEnabledByTenant = false;
Boolean isMultiAttributeLoginEnabledInTenant = false;
try {
PreferenceRetrievalClient preferenceRetrievalClient = new PreferenceRetrievalClient();
isQuestionBasedPasswordRecoveryEnabledByTenant = preferenceRetrievalClient.checkQuestionBasedPasswordRecovery(tenantDomain);
isNotificationBasedPasswordRecoveryEnabledByTenant = preferenceRetrievalClient.checkNotificationBasedPasswordRecovery(tenantDomain);
isMultiAttributeLoginEnabledInTenant = preferenceRetrievalClient.checkMultiAttributeLogin(tenantDomain);
} catch (PreferenceRetrievalClientException e) {
request.setAttribute("error", true);
request.setAttribute("errorMsg", IdentityManagementEndpointUtil
.i18n(recoveryResourceBundle, "something.went.wrong.contact.admin"));
IdentityManagementEndpointUtil.addErrorInformation(request, e);
request.getRequestDispatcher("error.jsp").forward(request, response);
}
String enterUsernameHereText = "Enter.your.username.here";
if (isMultiAttributeLoginEnabledInTenant) {
enterUsernameHereText = "Enter.your.identifier.here";
}
%>

<!doctype html>
Expand Down Expand Up @@ -153,7 +160,7 @@
%>
<div class="field">
<label for="username">
<%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, "Enter.your.username.here")%>
<%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, enterUsernameHereText)%>
</label>
<input id="username" name="username" value="<%=username%>" type="text" tabindex="0" required>
<%
Expand All @@ -171,7 +178,7 @@

<div class="field">
<label for="username">
<%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, "Enter.your.username.here")%>
<%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, enterUsernameHereText)%>
</label>
<input id="username" name="username" type="text" tabindex="0" required>
<%
Expand Down

0 comments on commit f44c7b8

Please sign in to comment.