From 26d94c4ba7dd12cfa433d0c037f3bba8f73995f4 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 30 Dec 2022 10:42:15 -0300 Subject: add login username validation & prevent safari to capitalize --- packages/demobank-ui/src/pages/RegistrationPage.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'packages/demobank-ui/src/pages/RegistrationPage.tsx') diff --git a/packages/demobank-ui/src/pages/RegistrationPage.tsx b/packages/demobank-ui/src/pages/RegistrationPage.tsx index 183fa993e..12b3b6978 100644 --- a/packages/demobank-ui/src/pages/RegistrationPage.tsx +++ b/packages/demobank-ui/src/pages/RegistrationPage.tsx @@ -47,7 +47,7 @@ export function RegistrationPage(): VNode { ); } -const usernameRegex = /^[a-z][a-zA-Z0-9]+$/; +export const USERNAME_REGEX = /^[a-z][a-zA-Z0-9]+$/; /** * Collect and submit registration data. @@ -64,12 +64,12 @@ function RegistrationForm(): VNode { const errors = undefinedIfEmpty({ username: !username ? i18n.str`Missing username` - : !usernameRegex.test(username) + : !USERNAME_REGEX.test(username) ? i18n.str`Use only letter and numbers starting with a lower case letter` : undefined, password: !password ? i18n.str`Missing password` - : !usernameRegex.test(password) + : !USERNAME_REGEX.test(password) ? i18n.str`Use only letter and numbers starting with a lower case letter` : undefined, repeatPassword: !repeatPassword -- cgit v1.2.3