feat: add validation for strong password

This commit is contained in:
Lakhan Samani
2022-03-17 15:35:07 +05:30
parent 47d67bf3cd
commit ec4ef97766
8 changed files with 84 additions and 4 deletions

View File

@@ -40,6 +40,10 @@ func SignupResolver(ctx context.Context, params model.SignUpInput) (*model.AuthR
return res, fmt.Errorf(`password and confirm password does not match`)
}
if !utils.IsValidPassword(params.Password) {
return res, fmt.Errorf(`password is not valid. It needs to be at least 6 characters long and contain at least one number, one uppercase letter, one lowercase letter and one special character`)
}
params.Email = strings.ToLower(params.Email)
if !utils.IsValidEmail(params.Email) {