Add button to show and hide password in the devise registrations form

Makes it easy for a user to check that he have typed the password correctly.
This commit is contained in:
David Moreno 2023-01-19 20:47:22 +01:00 committed by Henne Vogelsang
parent 6e276b2787
commit 1ff30d155d
4 changed files with 30 additions and 2 deletions

View file

@ -0,0 +1,15 @@
$( document ).ready(function() {
$('.osem-register button.show-or-hide-password').click(function() {
const is_locked = $(this).data('lock');
$(this).data('lock', !is_locked);
$(this).parents('.osem-register').find('input').attr('type', is_locked ? 'text' : 'password');
if (is_locked) {
$(this).find('.show-password').hide();
$(this).find('.hide-password').show();
} else {
$(this).find('.show-password').show();
$(this).find('.hide-password').hide();
}
} );
} );