Skip to content

Commit 24ec10d

Browse files
committed
[PLAT-2911] - fix : Remove the email check for LDAP users
Summary: 1. Removed email check for LDAP users. 2. Changed placeholder from **Email** to **Email or Username** in User Profile form to support both LDAP users and System users . 3. Changed placeholder from **Email** to **Email or Username** in Login form to support both LDAP users and System users . Test Plan: **Test Plan** Tested Manually **Screenshot** 1. No Email Regex check for LDAP users {F22236} 2. Email Regex check for Non-LDAP users. {F22237} 3. Login form {F22238} Reviewers: ssutar, mjoshi, cpadinjareveettil, kkannan Reviewed By: cpadinjareveettil, kkannan Subscribers: jenkins-bot, ui Differential Revision: https://phabricator.dev.yugabyte.com/D15204
1 parent 44585fe commit 24ec10d

File tree

2 files changed

+41
-39
lines changed

2 files changed

+41
-39
lines changed

managed/ui/src/components/common/forms/LoginForm/LoginForm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class LoginForm extends Component {
5959
} = this.props;
6060

6161
const validationSchema = Yup.object().shape({
62-
email: Yup.string().required('Enter email'),
62+
email: Yup.string().required('Enter Email or Username'),
6363

6464
password: Yup.string().required('Enter password')
6565
});
@@ -104,7 +104,7 @@ class LoginForm extends Component {
104104
<YBLabel {...props} name="email">
105105
<input
106106
className="form-control"
107-
placeholder="Email Address"
107+
placeholder="Email or Username"
108108
type="text"
109109
{...props.field}
110110
/>

managed/ui/src/components/profile/UserProfileForm.js

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -69,41 +69,6 @@ export default class UserProfileForm extends Component {
6969

7070
showOrRedirect(customer.data.features, 'main.profile');
7171

72-
const validationSchema = Yup.object().shape({
73-
name: Yup.string().required('Enter name'),
74-
75-
// Regex below matches either the default value 'admin' or a generic email address
76-
email: Yup.string()
77-
.matches(
78-
/(^admin$)|(^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$)/i,
79-
'This is not a valid email or value'
80-
)
81-
.required('Enter email'),
82-
83-
code: Yup.string()
84-
.required('Enter Environment name')
85-
.max(5, 'Environment name can be only 5 characters long'),
86-
87-
password: Yup.string()
88-
.notRequired()
89-
.min(
90-
minPasswordLength,
91-
`Password is too short - must be ${minPasswordLength} characters minimum.`
92-
)
93-
.matches(
94-
/^(?=.*[0-9])(?=.*[!@#$%^&*])(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9!@#$%^&*]{8,256}$/,
95-
`Password must contain at least ${passwordValidationInfo?.minDigits} digit
96-
, ${passwordValidationInfo?.minUppercase} capital
97-
, ${passwordValidationInfo?.minLowercase} lowercase
98-
and ${passwordValidationInfo?.minSpecialCharacters} of the !@#$%^&* (special) characters.`
99-
)
100-
.oneOf([Yup.ref('confirmPassword')], "Passwords don't match"),
101-
102-
confirmPassword: Yup.string()
103-
.notRequired()
104-
.oneOf([Yup.ref('password')], "Passwords don't match")
105-
});
106-
10772
// Filter users for userUUID set during login
10873
const loginUserId = localStorage.getItem('userId');
10974
const getCurrentUser = isNonEmptyArray(users)
@@ -135,6 +100,43 @@ export default class UserProfileForm extends Component {
135100
});
136101
});
137102

103+
const validationSchema = Yup.object().shape({
104+
name: Yup.string().required('Enter name'),
105+
106+
// Regex below matches either the default value 'admin' or a generic email address
107+
email: isLDAPUser
108+
? Yup.string().required('Enter Email or Username')
109+
: Yup.string()
110+
.matches(
111+
/(^admin$)|(^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$)/i,
112+
'This is not a valid email or value'
113+
)
114+
.required('Enter email'),
115+
116+
code: Yup.string()
117+
.required('Enter Environment name')
118+
.max(5, 'Environment name can be only 5 characters long'),
119+
120+
password: Yup.string()
121+
.notRequired()
122+
.min(
123+
minPasswordLength,
124+
`Password is too short - must be ${minPasswordLength} characters minimum.`
125+
)
126+
.matches(
127+
/^(?=.*[0-9])(?=.*[!@#$%^&*])(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9!@#$%^&*]{8,256}$/,
128+
`Password must contain at least ${passwordValidationInfo?.minDigits} digit
129+
, ${passwordValidationInfo?.minUppercase} capital
130+
, ${passwordValidationInfo?.minLowercase} lowercase
131+
and ${passwordValidationInfo?.minSpecialCharacters} of the !@#$%^&* (special) characters.`
132+
)
133+
.oneOf([Yup.ref('confirmPassword')], "Passwords don't match"),
134+
135+
confirmPassword: Yup.string()
136+
.notRequired()
137+
.oneOf([Yup.ref('password')], "Passwords don't match")
138+
});
139+
138140
return (
139141
<div className="bottom-bar-padding">
140142
<Formik
@@ -190,9 +192,9 @@ export default class UserProfileForm extends Component {
190192
name="email"
191193
readOnly={true}
192194
type="text"
193-
label="Email"
195+
label="Email or Username"
194196
component={YBFormInput}
195-
placeholder="Email Address"
197+
placeholder="Email or Username"
196198
/>
197199
<Field
198200
name="code"

0 commit comments

Comments
 (0)