Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
//= require osem-bootstrap
//= require osem-revisionhistory
//= require osem-commercials
//= require osem-register
//= require unobtrusive_flash
//= require unobtrusive_flash_bootstrap
//= require countable
Expand Down
15 changes: 15 additions & 0 deletions app/assets/javascripts/osem-register.js
Original file line number Diff line number Diff line change
@@ -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();
}
} );
} );
6 changes: 4 additions & 2 deletions app/views/devise/registrations/_form_fields.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
= f.label :password, 'Password'
- if [email protected]?
%abbr{title: 'This field is required'} *
= f.password_field :password, required: [email protected]?, class: 'form-control', placeholder: 'Password'
= render partial: 'devise/registrations/password_field_with_view_password_button', locals: { f: f, required: [email protected]?, placeholder: 'Password', method: :password }

.form-group
= f.label :password_confirmation, 'Password Confirmation'
= f.password_field :password_confirmation, required: [email protected]?, class: 'form-control', placeholder: 'Password Confirmation'
= render partial: 'devise/registrations/password_field_with_view_password_button', locals: { f: f, required: [email protected]?, placeholder: 'Password Confirmation', method: :password_confirmation }

- if @user.persisted?
%p.text-muted
Leave blank if you don't want to change your password
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.input-group.osem-register
= f.password_field method, required: required, class: 'form-control', placeholder: placeholder
.input-group-btn
%button.btn.btn-default{ type: 'button', class: 'show-or-hide-password', 'data-lock': "true" }
%span.show-password
%i.fa-solid.fa-lock
Show password
%span.hide-password{ style: 'display: none'}
%i.fa-solid.fa-unlock
Hide password