From 99cb7b519a47f663359f23e1a15428b57a51e815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20devkcud=20Albanese?= Date: Wed, 6 Nov 2024 11:24:46 -0300 Subject: [PATCH] chore: Make the password less strict --- pkg/utils/validator.go | 21 +-------------------- translations/en.yaml | 2 +- translations/pt.yaml | 2 +- translations/ru.yaml | 2 +- 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/pkg/utils/validator.go b/pkg/utils/validator.go index 24e384f..9a14dad 100644 --- a/pkg/utils/validator.go +++ b/pkg/utils/validator.go @@ -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 } diff --git a/translations/en.yaml b/translations/en.yaml index 58ad9f9..5260f89 100644 --- a/translations/en.yaml +++ b/translations/en.yaml @@ -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. diff --git a/translations/pt.yaml b/translations/pt.yaml index 343ad43..8cfe214 100644 --- a/translations/pt.yaml +++ b/translations/pt.yaml @@ -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). diff --git a/translations/ru.yaml b/translations/ru.yaml index 467f1ba..8c76848 100644 --- a/translations/ru.yaml +++ b/translations/ru.yaml @@ -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).