Skip to content

Commit

Permalink
(chore): Fixed the problem where Regex would not accept - and . symbols
Browse files Browse the repository at this point in the history
In the pull-request i fixed the problem of the password field telling Password must be at least 8 characters, include an uppercase letter, a number, and a special character. when using a - or a . in the password like for example tEsT-Sc1bBl!e$ab
  • Loading branch information
kilianbalaguer committed Nov 29, 2024
1 parent 4ad8caf commit 691c056
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/auth/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ function AuthContent({ router }: AuthContentProps) {

const validatePassword = (value: string) => {
const passwordRegex =
/^(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
/^(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&\-_.])[A-Za-z\d@$!%*?&\-_\.]{8,}$/;
setPasswordError(
passwordRegex.test(value)
? ''
: 'Password must be at least 8 characters, include an uppercase letter, a number, and a special character.'
);
};
};

const validateConfirmPassword = (value: string) => {
setConfirmPasswordError(
Expand Down

0 comments on commit 691c056

Please sign in to comment.