Skip to content

Commit 70a8683

Browse files
committed
fix password regex
1 parent e9a1d05 commit 70a8683

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Components/Forms/LoginForm/LoginForm.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const LoginForm = ({ onRegister, onLogin }) => {
3131
email: string().email('invalid email').required('please enter your email'),
3232
password: string().required('please enter your password')
3333
.min(8, 'your password must be 8 characters or more')
34-
.matches(/^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,16}$/, 'invalid password'),
34+
.matches(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/, 'invalid password'),
3535
}),
3636
onSubmit: ({ username, email, password }, { setFieldError }) => {
3737
const users = getStorage('users')

src/Components/Forms/RegisterForm/RegisterForm.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const RegisterForm = ({ onRegister, onLogin }) => {
3737
.max('2022-05-22', 'invalid birthday date'),
3838
password: string().required('please enter your password')
3939
.min(8, 'your password must be 8 characters or more')
40-
.matches(/^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,16}$/, 'invalid password'),
40+
.matches(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/, 'invalid password'),
4141
confirmPassword: string().required('please enter your confirm password')
4242
.oneOf([ref('password')], 'your confirm password must match'),
4343
}),

src/Components/Panel/UserChangePassword/UserChangePassword.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ const UserChangePassword = ({ password, onChangeInfo }) => {
2121
validationSchema: object({
2222
currentPassword: string().required('please enter your current password')
2323
.min(8, 'your current password must be 8 characters or more')
24-
.matches(/^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,16}$/, 'invalid password'),
24+
.matches(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/, 'invalid password'),
2525

2626
newPassword: string().required('please enter your new password')
2727
.min(8, 'your new password must be 8 characters or more')
28-
.matches(/^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,16}$/, 'invalid password'),
28+
.matches(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/, 'invalid password'),
2929

3030
confirmNewPassword: string().required('please enter your confirm new password')
31-
.matches(/^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,16}$/, 'invalid password')
31+
.matches(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/, 'invalid password')
3232
.oneOf([ref('newPassword')], 'your confirm new password must match')
3333
}),
3434
onSubmit: (values, { setFieldError }) => {

0 commit comments

Comments
 (0)