From 853858ad7b0988f62d8428fe5b2373b08f17e6b9 Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Thu, 17 Aug 2023 13:43:23 +1000 Subject: [PATCH] Address review --- .../src/authentication/components/resetPassword.tsx | 2 +- .../src/authentication/src/dashboard/validation.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/authentication/components/resetPassword.tsx b/app/ide-desktop/lib/dashboard/src/authentication/src/authentication/components/resetPassword.tsx index 769514a7ba62..5396303592e4 100644 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/authentication/components/resetPassword.tsx +++ b/app/ide-desktop/lib/dashboard/src/authentication/src/authentication/components/resetPassword.tsx @@ -133,7 +133,7 @@ export default function ResetPassword() { name="new_password" placeholder="New Password" pattern={validation.PASSWORD_PATTERN} - title={validation.PASSWORD_ERROR} + error={validation.PASSWORD_ERROR} value={newPassword} setValue={setNewPassword} /> diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/validation.ts b/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/validation.ts index f0a1906d544d..a27614689257 100644 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/validation.ts +++ b/app/ide-desktop/lib/dashboard/src/authentication/src/dashboard/validation.ts @@ -1,6 +1,17 @@ /** @file Validation patterns for text inputs. */ -/** Regex pattern for valid AWS Cognito passwords. */ +/** Regex pattern for valid AWS Cognito passwords. + * A fully correct regex is here: https://stackoverflow.com/a/58767981/3323231. + * Official documentation is here: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-policies.html. + * However, non-ASCII passwords are allowed, contrary to the official documentation. Further + * investigation may be needed. + * + * Each of the four lookaheads in the regex below check for, respectively: + * - a digit + * - a Basic Latin uppercase character + * - a Basic Latin lowercase character, and + * - an ASCII symbol. + */ export const PASSWORD_PATTERN = '(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])(?=.*[ ^$*.\\[\\]\\{\\}\\(\\)?"!@#%&\\/,><\':;\\|_~`=+\\-]).{6,256}' /** Human readable explanation of password requirements. */