Skip to content

Commit 2ed2c64

Browse files
committed
fix: allow default message to be displayed if psData is not set in usePasswordPolicy
1 parent e43db8a commit 2ed2c64

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/js/components/usePasswordPolicy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ const buildValidationMessage = (
9595
// Get base message
9696
if (!lengthValid) {
9797
const invalidElement = feedbackContainer.querySelector(PasswordPolicyMap.lengthMessage) as HTMLElement;
98-
message = `${invalidElement?.dataset?.psData}\n` || 'Your password length is invalid \n';
98+
message = `${invalidElement?.dataset?.psData || 'Your password length is invalid'}\n`;
9999
} else if (!strengthValid) {
100100
const invalidElement = feedbackContainer.querySelector(PasswordPolicyMap.invalidMessage) as HTMLElement;
101-
message = `${invalidElement?.dataset?.psData}\n` || 'Your password is too weak \n';
101+
message = `${invalidElement?.dataset?.psData || 'Your password is too weak'}\n`;
102102
}
103103

104104
// Get hints suggestions

0 commit comments

Comments
 (0)