Show/hide password on login page

This commit is contained in:
adhallet committed 2019-03-18 13:16:47 +01:00
1 parent ec13a8032c
commit bc3496663d
3 files changed
+19 -1

No files matched your search

@@ -0,0 +1,12 @@
function togglePasswordVisibility(){
let passwordField = document.getElementById('id_password');
let toggleIcon = document.getElementById('password-visibility-toggle');
if (passwordField.type === "password"){
passwordField.type = "text";
console.log(toggleIcon);
toggleIcon.classList.replace('fa-eye', 'fa-eye-slash');
} else {
passwordField.type = "password";
toggleIcon.classList.replace('fa-eye-slash', 'fa-eye');
}
}
@@ -30,6 +30,8 @@
<link rel="stylesheet" href="{% static "stylesheets/theme-extension.css" %}"/>
<link rel="stylesheet" href="{% static "stylesheets/theme-special-cases.css" %}"/>
<script src="{% static "authentication.js" %}"></script>
<!-- Skin CSS -->
<link rel="stylesheet" href="{% static "stylesheets/skins/default.css" %}"/>
</head>
@@ -85,7 +87,7 @@
<input id="id_password" name="password" type="password" class="form-control input-lg" required=""/>
<span class="input-group-addon">
<span class="icon icon-lg">
<i class="fa fa-lock"></i>
<i id="password-visibility-toggle" class="fas fa-eye allow-pointer-events" onclick="togglePasswordVisibility()"></i>
</span>
</span>
</div>
@@ -3789,6 +3789,10 @@ html.dark .form-bordered .form-group {
pointer-events: none;
}
.allow-pointer-events {
pointer-events: auto;
}
.input-group-icon .input-group-addon span.icon.icon-lg,
.input-search .input-group-addon span.icon.icon-lg {
padding: 10px 14px;