Skip to content

Commit df19234

Browse files
Merge pull request #9705 from JayaShakthi97/fix/email-field-validation
[bug-fix] Fix email field validation issue and email field clearing issue
2 parents 5e3d996 + 4c7a50c commit df19234

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

.changeset/pink-lobsters-hunt.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@wso2is/admin.users.v1": patch
3+
"@wso2is/console": patch
4+
---
5+
6+
Fix email field validation issue and email field clearing issue

features/admin.users.v1/components/user-profile/user-profile-form.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
2+
* Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).
33
*
44
* WSO2 LLC. licenses this file to you under the Apache License,
55
* Version 2.0 (the "License"); you may not use this file except
@@ -663,7 +663,7 @@ const UserProfileForm: FunctionComponent<UserProfileFormPropsInterface> = ({
663663
// Phone numbers are submitted as an array of phone number objects:
664664
// [ { type: "mobile", value: "1234567890" }, { type: "work", value: "1234567890" }].
665665
for (const [ type, value ] of Object.entries(
666-
values[fieldName] as Record<string, string>)) {
666+
(values[fieldName] ?? {}) as Record<string, string>)) {
667667
if (type === "primary") {
668668
patchValue.push(value);
669669
} else {
@@ -687,7 +687,7 @@ const UserProfileForm: FunctionComponent<UserProfileFormPropsInterface> = ({
687687
// [{ type: "home", formatted: "123 Main St" }, { type: "work", formatted: "456 Business St" }].
688688
// "formatted" property is added from UI.
689689
for (const [ type, value ] of Object.entries(
690-
values[fieldName] as Record<string, string>)) {
690+
(values[fieldName] ?? {}) as Record<string, string>)) {
691691
patchValue.push({
692692
formatted: value,
693693
type: type

features/admin.users.v1/components/wizard/steps/add-user-basic/add-user-basic.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2023-2025, WSO2 LLC. (https://www.wso2.com).
2+
* Copyright (c) 2023-2026, WSO2 LLC. (https://www.wso2.com).
33
*
44
* WSO2 LLC. licenses this file to you under the Apache License,
55
* Version 2.0 (the "License"); you may not use this file except
@@ -901,7 +901,7 @@ export const AddUserBasic: React.FunctionComponent<AddUserBasicProps> = ({
901901
if (isEmailRequired && isEmpty(value)) {
902902
errorMessage = t("user:forms.addUserForm.inputs.email.validations.empty");
903903

904-
} else if (!SharedUserStoreUtils.validateInputAgainstRegEx(value, emailClaimRegex)) {
904+
} else if (!isEmpty(value) && !SharedUserStoreUtils.validateInputAgainstRegEx(value, emailClaimRegex)) {
905905
errorMessage = USERNAME_REGEX_VIOLATION_ERROR_MESSAGE;
906906
}
907907

0 commit comments

Comments
 (0)