Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No space password with regex #166

Merged
merged 7 commits into from
May 25, 2023
3 changes: 2 additions & 1 deletion locales/en/signup.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"alreadyHaveAccount": "Already have an account?",
"authError": "Authentication failed",
"accountWithEmailAlreadyExist": "The account already exists for that email.",
"registerError": "Registration failed!"
"registerError": "Registration failed!",
"restrictedCharacterError": "Password contains illegal characters."
}
4 changes: 4 additions & 0 deletions src/features/authorization/managers/registerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export const useRegisterManager = () => {
.email(t('signup:incorrectEmail'))
.required(t('signup:required')),
password: Yup.string()
.matches(
/^[a-zA-Z0-9!@#$%^&*()_+-]+$/,
t('signup:restrictedCharacterError')
)
.min(8, t('signup:passwordLengthMin'))
.max(64, t('signup:passwordLengthMax'))
.required(t('signup:required')),
Expand Down