Bug 34778: Add a 'Show password' toggle when logging into the OPAC
1. Apply the patch 2. perl build-resources.PL 3. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl 4. Type "ABC" into the "Password" box and click "Show password" 5. Note that the password is now visible. Click again to hide password. 6. Click "Log in to your account" 7. Type "123" into the "Password" box and click "Show password" 8. Note that the password is now visible. Click again to hide password. 9. Note that the password on the main screen wasn't affected by the "Show password" in the modal 10. Repeat the above process on http://localhost:8080/cgi-bin/koha/opac-user.pl Signed-off-by: Emmanuel Bétemps <e.betemps@gmail.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Emmanuel Bétemps <e.betemps@gmail.com> Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
ba5689f731
commit
033a93e799
|
|
@ -2970,4 +2970,9 @@ $star-selected: #EDB867;
|
|||
}
|
||||
}
|
||||
|
||||
#loginModal .local-login input.show-password-toggle-checkbox {
|
||||
width: inherit;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
@import "responsive";
|
||||
|
|
|
|||
|
|
@ -441,6 +441,7 @@
|
|||
<div class="local-login">
|
||||
[% PROCESS login_label for="muserid" %]<input type="text" id="muserid" name="login_userid" autocomplete="off" />
|
||||
<label for="mpassword">Password:</label><input type="password" id="mpassword" name="login_password" autocomplete="off" />
|
||||
[% INCLUDE 'show-password-toggle.inc' checkbox_id_suffix='modal' %]
|
||||
<fieldset class="action">
|
||||
<input type="hidden" name="op" value="cud-login" />
|
||||
<input type="submit" class="btn btn-primary" value="Log in" />
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@
|
|||
[% END %]
|
||||
|
||||
[% Asset.js("lib/js-cookie/js.cookie-3.0.1.min.js") | $raw %]
|
||||
[% Asset.js("bootstrap/js/show-password-toggle.js") | $raw %]
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
if($('#searchsubmit').length) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
<div class="show-password-toggle">
|
||||
<input type="checkbox" class="show-password-toggle-checkbox">
|
||||
<span class="show-password-toggle-label"> Show password</span>
|
||||
</div>
|
||||
|
|
@ -249,6 +249,7 @@
|
|||
<label for="password">Password:</label>
|
||||
<input class="form-control" type="password" size="25" id="password" name="login_password" autocomplete="off" />
|
||||
</div>
|
||||
[% INCLUDE 'show-password-toggle.inc' %]
|
||||
<fieldset class="action">
|
||||
<input type="submit" value="Log in" class="btn btn-primary" />
|
||||
</fieldset>
|
||||
|
|
|
|||
|
|
@ -204,6 +204,7 @@
|
|||
<input class="form-control" type="text" id="userid" name="login_userid" autocomplete="off" />
|
||||
<label for="password">Password:</label>
|
||||
<input class="form-control" type="password" id="password" name="login_password" autocomplete="off" />
|
||||
[% INCLUDE 'show-password-toggle.inc' %]
|
||||
<fieldset class="action">
|
||||
<input type="hidden" name="op" value="cud-login" />
|
||||
<input type="submit" value="Log in" class="btn btn-primary" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const local_logins = document.querySelectorAll('.local-login');
|
||||
local_logins.forEach( (local_login) => {
|
||||
const password_field = local_login.querySelector('#password,#mpassword');
|
||||
const toggle_box = local_login.querySelector('input.show-password-toggle-checkbox');
|
||||
if (password_field && toggle_box){
|
||||
toggle_box.addEventListener('click',function(ev){
|
||||
if (password_field.type === 'password'){
|
||||
password_field.type = 'text';
|
||||
}
|
||||
else {
|
||||
password_field.type = 'password';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue