Skip to content

Commit

Permalink
Merge pull request #2574 from glific/feature/password-policy
Browse files Browse the repository at this point in the history
Updated password policy
  • Loading branch information
mdshamoon authored Sep 28, 2023
2 parents 70b3791 + 4a0131d commit 45a4a9c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/containers/Auth/Registration/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ export const Registration = () => {
name: Yup.string().required(t('Input required')),
phone: Yup.string().required(t('Input required')),
password: Yup.string()
.min(8, t('Password must be at least 8 characters long.'))
.matches(
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]+$/,
'Password must contain at least one lowercase letter, one uppercase letter, one number, and one special character'
)
.min(10, t('Password must be at least 10 characters long.'))
.required(t('Input required')),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ export const ResetPasswordConfirmOTP = () => {
const FormSchema = Yup.object().shape({
OTP: Yup.string().required(t('Input required')),
password: Yup.string()
.min(8, t('Password must be at least 8 characters long.'))
.matches(
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]+$/,
'Password must contain at least one lowercase letter, one uppercase letter, one number, and one special character'
)
.min(10, t('Password must be at least 10 characters long.'))
.required(t('Input required')),
});

Expand Down
6 changes: 5 additions & 1 deletion src/containers/MyAccount/MyAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ export const MyAccount = () => {
const FormSchema = Yup.object().shape({
otp: Yup.string().required(t('Input required')),
password: Yup.string()
.min(6, t('Password must be at least 8 characters long.'))
.matches(
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]+$/,
'Password must contain at least one lowercase letter, one uppercase letter, one number, and one special character'
)
.min(10, t('Password must be at least 10 characters long.'))
.required(t('Input required')),
});

Expand Down
2 changes: 1 addition & 1 deletion src/i18n/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"Invalid captcha": "Invalid captcha",
"Your full name": "Your full name",
"Your personal WhatsApp number": "Your personal WhatsApp number",
"Password must be at least 8 characters long.": "Password must be at least 8 characters long.",
"Password must be at least 10 characters long.": "Password must be at least 10 characters long.",
"Register with ": "Register with ",
"Login to Glific": "Login to Glific",
"Phone number": "Phone number",
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/hi/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"Please enter a valid OTP": "कृपया एक वैध OTP दर्ज करें",
"Too many attempts, please retry after sometime.": "बहुत सारे प्रयास, कृपया कुछ समय के बाद फिर से प्रयास करें ।",
"Input required": "इनपुट की आवश्यकता",
"Password must be at least 8 characters long.": "पासवर्ड कम से कम 8 वर्ण लंबा होना चाहिए।",
"Password must be at least 10 characters long.": "पासवर्ड कम से कम 10 वर्ण लंबा होना चाहिए।",
"Please confirm the OTP received at your WhatsApp number.": "कृपया अपने व्हाट्सएप नंबर पर प्राप्त ओटीपी की पुष्टि करें।",
"Change Password": "पासवर्ड बदलें",
"Generate OTP": "ओटीपी जनरेट करें",
Expand Down

0 comments on commit 45a4a9c

Please sign in to comment.