osem-fcy/app/assets/javascripts/osem-register.js
David Moreno 1ff30d155d 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.
2025-08-14 18:09:02 +02:00

15 lines
517 B
JavaScript

$( 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();
}
} );
} );