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

@@ -9,6 +9,9 @@ body {overflow: hidden;
h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px}
h2 {font-size: 18px; font-weight: normal; color: #fff}
.icon {position: absolute; margin-left: 2px}
.icon-tabler {width: 24px; height: 24px; stroke-width: 1.25; color: #888}
.blackMask {position: fixed; display: table; width: 100%; height: 100%; top: 0; left: 0; visibility: hidden; background-color: rgba(0,0,0,0.8); text-align: center; z-index: 100}
.blackMask .popupVCenter {#position: absolute; display: table-cell; #top: 50%; vertical-align: middle; text-align: center}
.popupVCenter .popup {#position: relative; #top: -50%; text-align: center; color: #fff; font-size: 10px}

View File

@@ -0,0 +1,21 @@
MIT License for https://github.com/tabler/tabler-icons
Copyright (c) 2020 Paweł Kuna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-alert-triangle" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z"/>
<path d="M12 9v2m0 4v.01" />
<path d="M5.07 19H19a2 2 0 0 0 1.75 -2.75L13.75 4a2 2 0 0 0 -3.5 0L3.25 16.25a2 2 0 0 0 1.75 2.75" />
</svg>

After

Width:  |  Height:  |  Size: 424 B

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];