Skip to content

Commit

Permalink
Set placeholder name according to the multi-attribute login config
Browse files Browse the repository at this point in the history
  • Loading branch information
sumedhe committed Sep 2, 2021
1 parent 3330580 commit d611373
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ welcome=Welcome
account.linking=Account Linking
username=Username
email.username=Email address
identifier.username=Identifier
password=Password
confirm.password=Confirm Password
email=Email
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ welcome=Bienvenue
account.linking=Liaison de compte
username=Nom d'utilisateur
email.username=Courriel (Nom d'utilisateur)
identifier.username=Identifiant
password=Mot de passe
confirm.password=Confirmer le mot de passe
email=Courriel
Expand Down
40 changes: 22 additions & 18 deletions apps/authentication-portal/src/main/webapp/basicauth.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,36 @@
Boolean isEmailUsernameEnabled = false;
String usernameLabel = "username";
Boolean isSelfSignUpEnabledInTenant = false;
Boolean isUsernameRecoveryEnabledInTenant = false;
Boolean isPasswordRecoveryEnabledInTenant = false;
Boolean isMultiAttributeLoginEnabledInTenant = false;
if (StringUtils.isNotBlank(emailUsernameEnable)) {
isEmailUsernameEnabled = Boolean.valueOf(emailUsernameEnable);
} else {
isEmailUsernameEnabled = isEmailUsernameEnabled();
}
try {
PreferenceRetrievalClient preferenceRetrievalClient = new PreferenceRetrievalClient();
isSelfSignUpEnabledInTenant = preferenceRetrievalClient.checkSelfRegistration(tenantDomain);
isUsernameRecoveryEnabledInTenant = preferenceRetrievalClient.checkUsernameRecovery(tenantDomain);
isPasswordRecoveryEnabledInTenant = preferenceRetrievalClient.checkPasswordRecovery(tenantDomain);
isMultiAttributeLoginEnabledInTenant = preferenceRetrievalClient.checkMultiAttributeLogin(tenantDomain);
} catch (PreferenceRetrievalClientException e) {
request.setAttribute("error", true);
request.setAttribute("errorMsg", AuthenticationEndpointUtil
.i18n(resourceBundle, "something.went.wrong.contact.admin"));
IdentityManagementEndpointUtil.addErrorInformation(request, e);
request.getRequestDispatcher("error.jsp").forward(request, response);
return;
}
if (isEmailUsernameEnabled == true) {
usernameLabel = "email.username";
} else if (isMultiAttributeLoginEnabledInTenant) {
usernameLabel = "identifier.username";
}
String resendUsername = request.getParameter("resend_username");
Expand Down Expand Up @@ -359,24 +381,6 @@
accountRegistrationEndpointURL = identityMgtEndpointContext + ACCOUNT_RECOVERY_ENDPOINT_REGISTER;
}
}
Boolean isSelfSignUpEnabledInTenant = false;
Boolean isUsernameRecoveryEnabledInTenant = false;
Boolean isPasswordRecoveryEnabledInTenant = false;
try {
PreferenceRetrievalClient preferenceRetrievalClient = new PreferenceRetrievalClient();
isSelfSignUpEnabledInTenant = preferenceRetrievalClient.checkSelfRegistration(tenantDomain);
isUsernameRecoveryEnabledInTenant = preferenceRetrievalClient.checkUsernameRecovery(tenantDomain);
isPasswordRecoveryEnabledInTenant = preferenceRetrievalClient.checkPasswordRecovery(tenantDomain);
} catch (PreferenceRetrievalClientException e) {
request.setAttribute("error", true);
request.setAttribute("errorMsg", AuthenticationEndpointUtil
.i18n(resourceBundle, "something.went.wrong.contact.admin"));
IdentityManagementEndpointUtil.addErrorInformation(request, e);
request.getRequestDispatcher("error.jsp").forward(request, response);
return;
}
%>

<div class="buttons">
Expand Down
15 changes: 15 additions & 0 deletions apps/authentication-portal/src/main/webapp/identifierauth.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,30 @@
String emailUsernameEnable = application.getInitParameter("EnableEmailUserName");
Boolean isEmailUsernameEnabled = false;
String usernameLabel = "username";
Boolean isMultiAttributeLoginEnabledInTenant = false;
if (StringUtils.isNotBlank(emailUsernameEnable)) {
isEmailUsernameEnabled = Boolean.valueOf(emailUsernameEnable);
} else {
isEmailUsernameEnabled = isEmailUsernameEnabled();
}
try {
PreferenceRetrievalClient preferenceRetrievalClient = new PreferenceRetrievalClient();
isMultiAttributeLoginEnabledInTenant = preferenceRetrievalClient.checkMultiAttributeLogin(tenantDomain);
} catch (PreferenceRetrievalClientException e) {
request.setAttribute("error", true);
request.setAttribute("errorMsg", AuthenticationEndpointUtil
.i18n(resourceBundle, "something.went.wrong.contact.admin"));
IdentityManagementEndpointUtil.addErrorInformation(request, e);
request.getRequestDispatcher("error.jsp").forward(request, response);
return;
}
if (isEmailUsernameEnabled == true) {
usernameLabel = "email.username";
} else if (isMultiAttributeLoginEnabledInTenant) {
usernameLabel = "identifier.username";
}
%>

Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@
<carbon.extension.identity.authenticator.version>3.0.0</carbon.extension.identity.authenticator.version>
<org.wso2.carbon.identity.association.account>5.1.5</org.wso2.carbon.identity.association.account>
<identity.extension.utils>1.0.8</identity.extension.utils>
<!-- TODO: Bump Framework version-->
<carbon.identity.framework.version>5.20.142</carbon.identity.framework.version>
<carbon.identity.framework.imp.pkg.version.range>[5.0.0, 6.0.0)</carbon.identity.framework.imp.pkg.version.range>
<carbon.identity.oauth.version>6.5.3</carbon.identity.oauth.version>
Expand Down

0 comments on commit d611373

Please sign in to comment.