Skip to content

fix: reject Cyrillic characters in signup passwords - #2346

Open
mvanhorn wants to merge 1 commit into
hexlet-codebattle:masterfrom
mvanhorn:fix/2341-signup-cyrillic-password-validation
Open

fix: reject Cyrillic characters in signup passwords#2346
mvanhorn wants to merge 1 commit into
hexlet-codebattle:masterfrom
mvanhorn:fix/2341-signup-cyrillic-password-validation

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Add a Cyrillic exclusion directly to schemas.signUp.password in apps/codebattle/assets/js/widgets/formik/index.ts, using a Unicode-aware Cyrillic script match (for example a Yup test with /\p{Script=Cyrillic}/u) and the clear message Password must not contain Cyrillic characters. Preserve the existing required, length, Latin-letter, digit, and confirmation checks, and preserve the existing missing-letter error for the original example by placing the new validation after the existing composition checks. This implements the thread's requested Cyrillic restriction without silently converting password text or replacing the current allowed characters with an ASCII-only whitelist. Issue #2341 requests an inline validation error and blocked registration when the password contains Cyrillic characters. The original example, 12345678ы, already fails the current signup schema's Latin-letter requirement, but the September 7 confirmation supplies as1234567ыы, which satisfies the existing letter and digit checks and passes validation. The current code locates signup at /users/new, rather than the report's /signup, and submits valid form values to /api/v1/users. The concrete defect is the missing Cyrillic check in the signup form; the thread's alternative assertion of an unhandled server error supplies no response or stack trace establishing a separate server failure.

Testing: Original report: submit otherwise valid values with 12345678ы in both password fields; show Should contain at least one letter and make no request; Confirmed failing case: submit as1234567ыы and matching confirmation; show the new Cyrillic-specific message and make no request. This case must fail against the existing code before the schema change.

Fixes #2341

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Password validation error when using Cyrillic characters during registration

1 participant