Skip to content

Commit

Permalink
added a check for forbidden characters in username
Browse files Browse the repository at this point in the history
  • Loading branch information
mad-chameleon committed Apr 8, 2024
1 parent 80b5618 commit c86d586
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frontend/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"emailIsUsed": "This email address is already being used",
"incorrectEmail": "Incorrect email",
"incorrectPassword": "Only Latin letters, numbers and punctuation are allowed",
"incorrectUsername": "There must be no spaces or slashes in the username",
"incorrectUsername": "Only Latin letters, numbers and symbols - _ are allowed",
"passwordLength": "From 8 to 30 characters",
"requiredField": "Required field",
"singleWord": "Allowed latin letters, numbers and symbols - _ .",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"emailIsUsed": "Этот адрес уже зарегистрирован",
"incorrectEmail": "Некорректная электронная почта",
"incorrectPassword": "Допустимы только латинские буквы, цифры и знаки препинания",
"incorrectUsername": "В логине не должно быть пробелов или символов слеша",
"incorrectUsername": "Допустимы только латинские буквы, цифры, и символы - _",
"passwordLength": "От 8 до 30 символов",
"requiredField": "Обязательное поле",
"singleWord": "Допустимы буквы латинского алфавита, цифры и символы -_ .",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/validationSchemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { string } from 'yup';

const USERNAME_MIN_LENGTH = 3;
const USERNAME_MAX_LENGTH = 16;
const USERNAME_REGEX = /^[^\s/\\]*$/;
const USERNAME_REGEX = /^[a-zA-Z0-9_-]+$/;

const PASSWORD_MIN_LENGTH = 8;
const PASSWORD_MAX_LENGTH = 30;
Expand Down

0 comments on commit c86d586

Please sign in to comment.