Skip to content

Commit

Permalink
Forbid colon from appearing in passwords
Browse files Browse the repository at this point in the history
Colon (:) can, if not quoted properly, confuse HTTP URLs with user:pass.
  • Loading branch information
rmunn authored and hahn-kev committed Jan 15, 2024
1 parent e7e7dca commit 46ec1f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/src/lib/forms/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function tryParse<T, ValidT>(zodType: ZodType<ValidT>, value: T): ValidT
export function passwordFormRules($t: Translater): z.ZodString {
return z.string()
.min(4, $t('form.password.too_short'))
.regex(/^[^&%+]+$/, $t('form.password.forbidden_characters'));
.regex(/^[^&%:+]+$/, $t('form.password.forbidden_characters'));
}

export function emptyString(): z.ZodString {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ the [Linguistics Institute at Payap University](https://li.payap.ac.th/) in Chia
},
"form": {
"password": {
"forbidden_characters": "The symbols &, +, and % are not allowed in passwords",
"forbidden_characters": "The symbols &, +, :, and % are not allowed in passwords",
"too_short": "Must be at least 4 characters"
}
},
Expand Down

0 comments on commit 46ec1f2

Please sign in to comment.