Skip to content

Commit 1437bd8

Browse files
committed
Add tooltip for allowed non-alphanumeric characters
1 parent 7031675 commit 1437bd8

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

packages/auth/demo/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@
397397
Password must contain a numeric character.
398398
</li>
399399
<li class="list-group-item" id="password-validation-contains-non-alphanumeric">
400-
Password must contain a non-alphanumeric character.
400+
Password must contain a non-alphanumeric character. <span class="glyphicon glyphicon-info-sign" id="password-validation-allowed-non-alphanumeric-characters" data-toggle="tooltip" data-placement="bottom" title="No allowed non-alphanumeric characters." aria-label="View non-alphanumeric characters"></span>
401401
</li>
402402
</ul>
403403
</form>

packages/auth/demo/public/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ body.user-info-displayed {
8787
list-style-type: none;
8888
}
8989

90+
#password-validation-contains-non-alphanumeric .tooltip {
91+
font-family: 'Courier New', Courier;
92+
font-size: 1.1em;
93+
letter-spacing: 5px;
94+
}
95+
9096
.logs {
9197
color: #555;
9298
font-family: 'Courier New', Courier;

packages/auth/demo/src/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,8 @@ function onValidatePassword() {
523523
const password = $('#password-validation-password').val();
524524
validatePassword(auth, password).then(
525525
status => {
526-
const customStrengthOptions = status.passwordPolicy.customStrengthOptions;
526+
const passwordPolicy = status.passwordPolicy;
527+
const customStrengthOptions = passwordPolicy.customStrengthOptions;
527528

528529
// Only show options required by the password policy.
529530
if (customStrengthOptions.minPasswordLength) {
@@ -536,6 +537,12 @@ function onValidatePassword() {
536537
customStrengthOptions.maxPasswordLength
537538
);
538539
}
540+
if (customStrengthOptions.containsNonAlphanumericCharacter) {
541+
$('#password-validation-allowed-non-alphanumeric-characters').attr(
542+
'data-original-title',
543+
passwordPolicy.allowedNonAlphanumericCharacters
544+
);
545+
}
539546
setRequirementStatus(
540547
'#password-validation-meets-min-length',
541548
status.meetsMinPasswordLength

0 commit comments

Comments
 (0)