Skip to content

Commit

Permalink
Merge pull request #266 from fnf-org/mfl/password-usability
Browse files Browse the repository at this point in the history
Mfl/password usability
  • Loading branch information
beingmattlevy authored Aug 15, 2024
2 parents 58040e2 + 99e28fc commit a84e429
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/models/ticket_request_event_addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ def purchase_category(category)
end

def name_category_price_each
"#{name} #{purchase_category(category)} @ #{price} each"
"#{name} #{purchase_category(category)} @ $#{price} each"
end
end
22 changes: 10 additions & 12 deletions app/views/devise/passwords/edit.html.haml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
%h2 Change your password
%h3 Change your password
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }, data: { turbo: false } ) do |f|
= render "devise/shared/error_messages", resource: resource
= f.hidden_field :reset_password_token
.field
%p= f.label :password, "New password"
- if @minimum_password_length
%p
%em
(#{@minimum_password_length} characters minimum)
%br
%strong= "New Password"
%small.fst-italic.text-nowrap
= " (#{@minimum_password_length} characters minimum)"
%p= f.password_field :password, autofocus: true, autocomplete: "new-password"
.field
%p= f.label :password_confirmation, "Confirm new password"
- if @minimum_password_length
%p
%em
(#{@minimum_password_length} characters minimum)
%p= f.password_field :password_confirmation, autocomplete: "new-password"
%br
%strong= "New Password Confirmation"
%small.fst-italic.text-nowrap
= " (#{@minimum_password_length} characters minimum)"
%p= f.password_field :password_confirmation, autocomplete: "new-password", required: true
.actions
= f.submit "Change my password", class: 'btn btn-primary btn-large'
= render "devise/shared/links"
25 changes: 16 additions & 9 deletions app/views/devise/registrations/_change_password.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,34 @@
.col-12
.vertical-20
- if existing
%small.nowrap NOTE: leave these fields blank if you don't want to change your password.
%strong= "Change Password"
%br
%small.fst-italic.nowrap Leave blank if you don't want to change your password.
- else
%h5 Please enter and confirm your new password.
NOTE: Passwords must be at least 6 characters long.
%strong.fst-italic.text-nowrap Passwords must be at least 6 characters long.

.row
.col-5
= f.label :password do
%strong= "Password:"
- if existing
%strong= "New Password:"
- else
%strong= "Password:"
- if @minimum_password_length
%br
%small.text-nowrap
NOTE:
= "#{@minimum_password_length} characters minimum"
= f.password_field :password, autocomplete: "new-password"
%normal.fst-italic.nowrap (#{@minimum_password_length} characters minimum)
= f.password_field :password, autocomplete: "new-password", min_length: @minimum_password_length

.col-7
= f.label :password_confirmation do
%strong= "Password Confirmation:"
- if existing
%strong= "New Password Confirmation:"
- else
%strong= "Password Confirmation:"
- if @minimum_password_length
%br
%normal.fst-italic.nowrap (#{@minimum_password_length} characters minimum)
%br

%p= f.password_field :password_confirmation, autocomplete: "new-password"
%p= f.password_field :password_confirmation, autocomplete: "new-password", min_length: @minimum_password_length
18 changes: 9 additions & 9 deletions app/views/devise/shared/_register.html.haml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
%h2 Register New Account

- http_method = existing ? :put : :post
= form_for(resource, as: resource_name, url: user_registration_path, html: { method: http_method }, data: { turbo: false } ) do |f|
= hidden_field_tag :authenticity_token, form_authenticity_token

= render "devise/shared/error_messages", resource: resource
- unless existing
%h2 Register New Account

.container-fluid
.row
Expand All @@ -24,18 +25,18 @@
- if defined?(redirect_to)
= hidden_field_tag :redirect_to, redirect_to

%br
%hr
= render partial: 'devise/registrations/change_password', locals: { existing: existing, f: f }
%br
%hr
- if existing
.row
.col-md-6.col-sm-12
%p.lead
We need your current password to confirm your changes
%strong= "Your current password is required make changes to your account"
%strong
= f.label :current_password
%br
= f.password_field :current_password, autocomplete: "current-password"
= f.password_field :current_password, autocomplete: "current-password", required: true


.row
Expand All @@ -44,12 +45,11 @@
= f.submit "Update", class: 'btn btn-primary btn-large w-1'

- unless existing

.row
.col-12
.actions.btn-group-md
= f.submit "Register", class: 'btn btn-primary btn-lg'
- if controller_name != 'ticket_requests'
= link_to "Go Back ↩".html_safe, :back, class: 'btn btn-warning btn-md'
%p= link_to "Forgot your password?", new_password_path(resource_name)

- if controller_name != 'ticket_requests'
= link_to "Go Back ↩".html_safe, :back, class: 'btn btn-warning btn-md'

2 changes: 1 addition & 1 deletion app/views/ticket_requests/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- if signed_in? && @user.present?
%h4 Ticket Request for #{@user.name}
- else
%h5 Please sign-in or register to request tickets.
%h5 Please log-in or register to request tickets
.card-body
= render 'shared/form_errors', resource: @ticket_request
Expand Down

0 comments on commit a84e429

Please sign in to comment.