From f38a5dc98a14b49874469c1dd0919a6d2ea5ec5b Mon Sep 17 00:00:00 2001 From: DilshanSenarath <74205483+DilshanSenarath@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:07:48 +0530 Subject: [PATCH 1/3] fix the issue in the self-registration flow when the email address is configured as a unique value --- .../self-registration-with-verification.jsp | 62 ++++++++++++------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-with-verification.jsp b/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-with-verification.jsp index f657128161f..f7a75388f29 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-with-verification.jsp +++ b/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-with-verification.jsp @@ -81,7 +81,6 @@ JSONObject usernameValidityResponse; String username = request.getParameter("username"); String password = request.getParameter("password"); - String emailValue = request.getParameter("username"); String consentPurposeGroupName = "SELF-SIGNUP"; String consentPurposeGroupType = "SYSTEM"; String[] missingClaimList = new String[0]; @@ -147,10 +146,16 @@ // Get validation configuration. ValidationConfigurationRetrievalClient validationConfigurationRetrievalClient = new ValidationConfigurationRetrievalClient(); JSONObject passwordConfig = null; + JSONObject usernameConfig = null; try { passwordConfig = validationConfigurationRetrievalClient.getPasswordConfiguration(tenantDomain); + usernameConfig = validationConfigurationRetrievalClient.getUsernameConfiguration(tenantDomain); } catch (Exception e) { - passwordConfig = null; + usernameConfig = null; + } + Boolean isAlphanumericUsernameEnabled = false; + if (usernameConfig.has("alphanumericFormatValidator")) { + isAlphanumericUsernameEnabled = (Boolean) usernameConfig.get("alphanumericFormatValidator"); } try { @@ -435,7 +440,7 @@ class="form-control required usrName usrNameLength">
- +
- - value="<%= Encode.forHtmlAttribute(user.getUsername())%>" readonly - <% } %> - <% if (emailNamePII.getValidationRegex() != null) { - String pattern = Encode.forHtmlContent(emailNamePII.getValidationRegex()); - String[] patterns = pattern.split("\\\\@"); - String regex = StringUtils.join(patterns, "@"); - %> - pattern="<%= regex %>" - <% } %> - <% if (emailNamePII.getRequired() || !piisConfigured) {%> required <%}%> - <% if - (skipSignUpEnableCheck && StringUtils.isNotEmpty(emailValue)) {%> - disabled<%}%> - value="<%= Encode.forHtmlAttribute(emailValue)%>" - placeholder="<%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, "Email")%>" - /> +
+ + + value="<%= Encode.forHtmlAttribute(user.getUsername())%>" readonly + <% } %> + <% if (emailNamePII.getValidationRegex() != null) { + String pattern = Encode.forHtmlContent(emailNamePII.getValidationRegex()); + String[] patterns = pattern.split("\\\\@"); + String regex = StringUtils.join(patterns, "@"); + %> + pattern="<%= regex %>" + <% } %> + <% if (emailNamePII.getRequired() || !piisConfigured) {%> required <%}%> + <% if + (skipSignUpEnableCheck && StringUtils.isNotEmpty(emailValue)) {%> + disabled<%}%> + value="<% if (StringUtils.isNotEmpty(emailValue)) { %><%=Encode.forHtmlAttribute(emailValue)%><% } %>" + placeholder="<%=IdentityManagementEndpointUtil.i18n(recoveryResourceBundle, "Email")%>" + /> +
<% } From 252656fabda8b35f6e52fb8834dab91be9dbaaf2 Mon Sep 17 00:00:00 2001 From: DilshanSenarath <74205483+DilshanSenarath@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:11:59 +0530 Subject: [PATCH 2/3] =?UTF-8?q?Add=20changeset=20=F0=9F=A6=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/swift-humans-bow.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/swift-humans-bow.md diff --git a/.changeset/swift-humans-bow.md b/.changeset/swift-humans-bow.md new file mode 100644 index 00000000000..90da9c93e58 --- /dev/null +++ b/.changeset/swift-humans-bow.md @@ -0,0 +1,5 @@ +--- +"@wso2is/identity-apps-core": patch +--- + +Fix the issue in the self-registration flow when the email address is configured as a unique value From 807b6cbd3da9be8049aeeb4787657e07ac8259e2 Mon Sep 17 00:00:00 2001 From: DilshanSenarath <74205483+DilshanSenarath@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:13:35 +0530 Subject: [PATCH 3/3] add a new line --- .../src/main/webapp/self-registration-with-verification.jsp | 1 + 1 file changed, 1 insertion(+) diff --git a/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-with-verification.jsp b/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-with-verification.jsp index f7a75388f29..3f7e8b12177 100644 --- a/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-with-verification.jsp +++ b/identity-apps-core/apps/recovery-portal/src/main/webapp/self-registration-with-verification.jsp @@ -153,6 +153,7 @@ } catch (Exception e) { usernameConfig = null; } + Boolean isAlphanumericUsernameEnabled = false; if (usernameConfig.has("alphanumericFormatValidator")) { isAlphanumericUsernameEnabled = (Boolean) usernameConfig.get("alphanumericFormatValidator");