Skip to content

Commit

Permalink
New password must be at least 12 chars long
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Oct 19, 2023
1 parent a2438b6 commit 5693926
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/helpers/validateNewPassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const validateNewPassword = (password: string): string => {

if (!password) {
errorMsg = "Password is required";
} else if (password.length < 8) {
errorMsg = "Password must be at least 8 characters long";
} else if (password.length < 12) {
errorMsg = "Password must be at least 12 characters long";
} else if (!passwordStrength.test(password)) {
errorMsg =
"Password must have at least one uppercase letter, lowercase letter, number, and symbol.";
Expand Down
14 changes: 11 additions & 3 deletions src/pages/ResetPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,16 @@ export const ResetPassword = () => {

{forgotPassword.errorString && (
<Notification variant="error" title="Reset password error">
{forgotPassword.errorString}. Check your email for the correct
token.
{forgotPassword.errorString}
{forgotPassword.errorExtras ? (
<ul className="ErrorExtras">
{Object.entries(forgotPassword.errorExtras).map(
([key, value]) => (
<li key={key}>{`${key}: ${value}`}</li>
),
)}
</ul>
) : null}
</Notification>
)}

Expand All @@ -95,7 +103,7 @@ export const ResetPassword = () => {
<div className="Note">
New password must be:
<ul>
<li>at least 8 characters long,</li>
<li>at least 12 characters long,</li>
<li>
a combination of uppercase letters, lowercase letters,
numbers, and symbols.
Expand Down
2 changes: 1 addition & 1 deletion src/pages/SetNewPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const SetNewPassword = () => {
<div className="Note">
New password must be:
<ul>
<li>at least 8 characters long,</li>
<li>at least 12 characters long,</li>
<li>
a combination of uppercase letters, lowercase letters,
numbers, and symbols.
Expand Down

0 comments on commit 5693926

Please sign in to comment.