Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #104 from swibly/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
devkcud authored Nov 6, 2024
2 parents 084f0ab + 99cb7b5 commit dec9aed
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 23 deletions.
21 changes: 1 addition & 20 deletions pkg/utils/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,7 @@ func newValidator() *validator.Validate {
vv.RegisterValidation("password", func(fl validator.FieldLevel) bool {
password := fl.Field().String()

if len(password) < 7 {
return false
}

// \d stands for digits [0-9]
// \W_ stands for [^a-zA-Z0-9_]

if !regexp.MustCompile(`\d`).MatchString(password) {
return false
}

if !regexp.MustCompile(`[A-Z]`).MatchString(password) {
return false
}

if !regexp.MustCompile(`[\W_]`).MatchString(password) {
return false
}

if !regexp.MustCompile(`[a-z]`).MatchString(password) {
if len(password) < 6 {
return false
}

Expand Down
2 changes: 1 addition & 1 deletion translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ user_following_started: User started following %s.
user_following_stopped: User stopped following %s.
user_not_found: User not found; are you sure this is their username?
validator_incorrect_email_format: Email format is incorrect.
validator_incorrect_password_format: The password should have a minimum of 8 characters, contain at least one uppercase letter, one lowercase letter, one special character, and one numeral.
validator_incorrect_password_format: The password must be at least 6 characters long.
validator_incorrect_username_format:
Usernames must consist only of lowercase alphanumeric (a-z & 0-9)
characters.
Expand Down
2 changes: 1 addition & 1 deletion translations/pt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ user_following_started: Usuário começou a seguir %s.
user_following_stopped: Usuário parou de seguir %s.
user_not_found: Usuário não encontrado; você tem certeza de que este é o nome de usuário?
validator_incorrect_email_format: Formato de email incorreto.
validator_incorrect_password_format: A senha deve ter no mínimo 8 caracteres, conter pelo menos uma letra maiúscula, uma letra minúscula, um caractere especial e um numeral.
validator_incorrect_password_format: A senha deve ter pelo menos 6 caracteres.
validator_incorrect_username_format:
Os nomes de usuário devem consistir apenas de caracteres alfanuméricos
minúsculos (a-z e 0-9).
Expand Down
2 changes: 1 addition & 1 deletion translations/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ user_following_started: Пользователь начал следовать %
user_following_stopped: Пользователь прекратил следовать за %s.
user_not_found: Пользователь не найден; вы уверены, что это его имя пользователя?
validator_incorrect_email_format: Формат электронной почты неверен.
validator_incorrect_password_format: Пароль должен содержать не менее 8 символов, включать хотя бы одну заглавную букву, одну строчную букву, один специальный символ и одну цифру.
validator_incorrect_password_format: Пароль должен содержать не менее 6 символов.
validator_incorrect_username_format:
Имена пользователей должны состоять только из строчных буквенно-цифровых
символов (a-z и 0-9).
Expand Down

0 comments on commit dec9aed

Please sign in to comment.