Shows caps lock warning icon on login screen now

This commit is contained in:
mattpass
2020-08-13 11:35:57 +01:00
parent 2df787655d
commit fbe19fc431
4 changed files with 48 additions and 2 deletions

View File

@@ -33,7 +33,13 @@ echo $settingPW ? "Setup" : "Login";
<?php
if ($ICEcoder["multiUser"]) {echo '<input type="text" name="username" class="password"><br><br>';};
?>
<input type="password" name="password" class="password" id="password"<?php if ($settingPW) {?> onkeyup="pwStrength(this.value)" onchange="pwStrength(this.value)" onpaste="pwStrength(this.value)"<?php } ?>><br>
<input type="password" name="password" class="password" id="password"<?php
if ($settingPW) {
?> onkeyup="checkCase(event); pwStrength(this.value)" onchange="pwStrength(this.value)" onpaste="pwStrength(this.value)"<?php
} else {
?> onkeyup="checkCase(event)"<?php
}
?>><div class="icon" style="display: none" id="capsLockDisplay" title="Caps lock on"><?php echo file_get_contents("../assets/images/icons/alert-triangle.svg");?></div><br>
<?php
if ($settingPW) {
echo '<div id="pwReqs">'.
@@ -106,8 +112,19 @@ const pwStrength = function(pw) {
return (true === chars && true === upper && true === lower && true === num && true === special);
};
const checkCase = function(evt) {
const key = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode;
// Not caps lock key
if (20 !== key) {
get("capsLockDisplay").style.display = true === evt.getModifierState("CapsLock")
? "inline-block"
: "none";
}
};
// Check if we can submit, else shake requirements
var checkCanSubmit = function() {
const checkCanSubmit = function() {
// Password isn't strong enough, shake requirements
if(false === pwStrength(get("password").value)) {
var posArray = [6, -6, 3, -3, 0];