Skip to content

Commit

Permalink
Improve password reset flow, normalize translations
Browse files Browse the repository at this point in the history
  • Loading branch information
zachgoll committed Nov 5, 2024
1 parent cee9692 commit f2739b7
Show file tree
Hide file tree
Showing 22 changed files with 58 additions and 69 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
}

.btn {
@apply px-3 py-2 rounded-lg text-sm font-medium cursor-pointer;
@apply px-3 py-2 rounded-lg text-sm font-medium cursor-pointer focus:outline-gray-500;
}

.btn--primary {
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/password_resets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def create
).password_reset.deliver_later
end

redirect_to root_path, notice: t(".requested")
redirect_to new_password_reset_path(step: "pending")
end

def edit
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: ENV["EMAIL_SENDER"] if ENV["EMAIL_SENDER"].present?
default from: email_address_with_name(ENV.fetch("EMAIL_SENDER", "[email protected]"), "Maybe Finance")
layout "mailer"
end
15 changes: 3 additions & 12 deletions app/views/password_resets/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,8 @@
%>
<%= styled_form_with model: @user, url: password_reset_path(token: params[:token]), method: :patch, class: "space-y-4" do |form| %>
<div class="relative border border-gray-100 bg-gray-25 rounded-xl focus-within:bg-white focus-within:shadow focus-within:opacity-100">
<%= form.label :password, class: "p-4 pb-0 block text-sm font-medium text-gray-700" %>
<%= form.password_field :password, required: "required", class: "p-4 pt-1 bg-transparent border-none opacity-50 focus:outline-none focus:ring-0 focus-within:opacity-100 w-full" %>
</div>
<%= form.password_field :password, required: true, label: true %>
<%= form.password_field :password_confirmation, required: true, label: true %>
<div class="relative border border-gray-100 bg-gray-25 rounded-xl focus-within:bg-white focus-within:shadow focus-within:opacity-100">
<%= form.label :password_confirmation, class: "p-4 pb-0 block text-sm font-medium text-gray-700" %>
<%= form.password_field :password_confirmation, required: "required", class: "p-4 pt-1 bg-transparent border-none opacity-50 focus:outline-none focus:ring-0 focus-within:opacity-100 w-full" %>
</div>

<div>
<%= form.submit t(".submit"), class: "flex justify-center w-full px-4 py-3 text-sm font-medium text-white bg-black rounded-xl hover:bg-black focus:outline-none focus:ring-2 focus:ring-gray-200 shadow" %>
</div>
<%= form.submit %>
<% end %>
14 changes: 8 additions & 6 deletions app/views/password_resets/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<%
header_title t(".title")
%>
<% header_title t(".title") %>
<%= styled_form_with url: password_reset_path, class: "space-y-4" do |form| %>
<%= form.email_field :email, label: true, autofocus: false, autocomplete: "email", required: "required", placeholder: "[email protected]" %>
<% if params[:step] == "pending" %>
<p class="text-sm text-gray-500 text-center"><%= t(".requested") %></p>
<% else %>
<%= styled_form_with url: password_reset_path, class: "space-y-4" do |form| %>
<%= form.email_field :email, label: true, autofocus: false, autocomplete: "email", required: "required", placeholder: "[email protected]" %>
<%= form.submit t(".submit") %>
<%= form.submit t(".submit") %>
<% end %>
<% end %>
5 changes: 1 addition & 4 deletions config/locales/mailers/invitation_mailer/en.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
en:
invitation_mailer:
invite_email:
subject: "%{inviter} has invited you to join their household on Maybe!"
greeting: "You've been invited!"
body: "%{inviter} has invited you to join their household '%{family}' as a %{role}."
accept_button: "Accept Invitation"
expiry_notice: "This invitation will expire in %{days} days."
8 changes: 4 additions & 4 deletions config/locales/views/accounts/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ en:
new_account: New account
no_accounts: No accounts yet
form:
balance: Current balance
balance: Current balance
institution: Financial institution
name_label: Account name
name_placeholder: Example account name
Expand All @@ -36,12 +36,12 @@ en:
institutionless_accounts:
other_accounts: Other accounts
new_account: New account
new:
new:
import_accounts: Import accounts
method_selector:
connected_entry: Link account (coming soon)
manual_entry: Enter account balance
title: How would you like to add it?
import_accounts: Import accounts
title: What would you like to add?
show:
chart:
Expand Down Expand Up @@ -73,4 +73,4 @@ en:
sync_all:
success: Successfully queued accounts for syncing.
sync_all_button:
sync: Sync all
sync: Sync all
4 changes: 2 additions & 2 deletions config/locales/views/credit_cards/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ en:
credit_cards:
create:
success: Credit card account created
edit:
edit: Edit %{account}
destroy:
success: Credit card account deleted
edit:
edit: Edit %{account}
form:
annual_fee: Annual fee
annual_fee_placeholder: '99'
Expand Down
4 changes: 2 additions & 2 deletions config/locales/views/cryptos/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ en:
cryptos:
create:
success: Crypto account created
destroy:
success: Crypto account deleted
edit:
edit: Edit %{account}
new:
title: Enter account balance
update:
success: Crypto account updated
destroy:
success: Crypto account deleted
4 changes: 2 additions & 2 deletions config/locales/views/depositories/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ en:
depositories:
create:
success: Depository account created
destroy:
success: Depository account deleted
edit:
edit: Edit %{account}
form:
Expand All @@ -12,5 +14,3 @@ en:
title: Enter account balance
update:
success: Depository account updated
destroy:
success: Depository account deleted
4 changes: 2 additions & 2 deletions config/locales/views/investments/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ en:
investments:
create:
success: Investment account created
destroy:
success: Investment account deleted
edit:
edit: Edit %{account}
form:
Expand All @@ -14,8 +16,6 @@ en:
chart_title: Total value
update:
success: Investment account updated
destroy:
success: Investment account deleted
value_tooltip:
cash: Cash
holdings: Holdings
Expand Down
7 changes: 4 additions & 3 deletions config/locales/views/invitation_mailer/en.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
en:
invitation_mailer:
invite_email:
greeting: "Welcome to Maybe!"
accept_button: Accept Invitation
body: "%{inviter} has invited you to join the %{family} family on Maybe!"
accept_button: "Accept Invitation"
expiry_notice: "This invitation will expire in %{days} days"
expiry_notice: This invitation will expire in %{days} days
greeting: Welcome to Maybe!
15 changes: 8 additions & 7 deletions config/locales/views/invitations/en.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
en:
invitations:
create:
success: "Invitation sent successfully"
failure: "Could not send invitation"
failure: Could not send invitation
success: Invitation sent successfully
new:
title: Invite Someone
subtitle: Send an invitation to join your family account on Maybe
email_placeholder: Enter email address
email_label: Email Address
role_member: Member
email_placeholder: Enter email address
role_admin: Administrator
role_label: Role
submit: Send Invitation
role_member: Member
submit: Send Invitation
subtitle: Send an invitation to join your family account on Maybe
title: Invite Someone
4 changes: 2 additions & 2 deletions config/locales/views/loans/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ en:
loans:
create:
success: Loan account created
edit:
edit: Edit %{account}
destroy:
success: Loan account deleted
edit:
edit: Edit %{account}
form:
interest_rate: Interest rate
interest_rate_placeholder: '5.25'
Expand Down
4 changes: 2 additions & 2 deletions config/locales/views/other_assets/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ en:
other_assets:
create:
success: Other asset account created
edit:
edit: Edit %{account}
destroy:
success: Other asset account deleted
edit:
edit: Edit %{account}
new:
title: Enter asset details
update:
Expand Down
4 changes: 2 additions & 2 deletions config/locales/views/other_liabilities/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ en:
other_liabilities:
create:
success: Other liability account created
edit:
edit: Edit %{account}
destroy:
success: Other liability account deleted
edit:
edit: Edit %{account}
new:
title: Enter liability details
update:
Expand Down
5 changes: 1 addition & 4 deletions config/locales/views/password_resets/en.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
---
en:
password_resets:
create:
requested: If an account with that email exists, we have sent a link to reset
your password.
edit:
submit: Update Password
title: Reset password
new:
requested: Please check your email for a link to reset your password.
submit: Reset password
title: Reset password
update:
Expand Down
4 changes: 2 additions & 2 deletions config/locales/views/properties/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ en:
properties:
create:
success: Property account created
edit:
edit: Edit %{account}
destroy:
success: Property account deleted
edit:
edit: Edit %{account}
form:
address_line1: Street address
address_line1_placeholder: 123 Main St
Expand Down
8 changes: 4 additions & 4 deletions config/locales/views/registrations/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ en:
invalid_invite_code: Invalid invite code, please try again.
success: You have signed up successfully.
new:
invitation_message: "%{inviter} has invited you to join as a %{role}"
join_family_title: Join %{family}
role_admin: administrator
role_member: member
submit: Create account
title: Create your account
join_family_title: "Join %{family}"
invitation_message: "%{inviter} has invited you to join as a %{role}"
role_member: "member"
role_admin: "administrator"
welcome_body: To get started, you must sign up for a new account. You will
then be able to configure additional settings within the app.
welcome_title: Welcome to Self Hosted Maybe!
6 changes: 3 additions & 3 deletions config/locales/views/settings/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ en:
theme_title: Theme
profiles:
show:
invite_member: "Add member"
confirm_delete:
body: Are you sure you want to permanently delete your account? This action
is irreversible.
Expand All @@ -56,13 +55,14 @@ en:
household_subtitle: Invite family members, partners and other inviduals. Invitees
can login to your household and access your shared accounts.
household_title: Household
invitation_link: Invitation link
invite_member: Add member
last_name: Last Name
page_title: Account
pending: Pending
profile_subtitle: Customize how you appear on Maybe
profile_title: Profile
save: Save
pending: Pending
invitation_link: Invitation link
user_avatar_field:
accepted_formats: JPG or PNG. 5MB max.
choose: Choose
4 changes: 2 additions & 2 deletions config/locales/views/vehicles/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ en:
vehicles:
create:
success: Vehicle account created
edit:
edit: Edit %{account}
destroy:
success: Vehicle account deleted
edit:
edit: Edit %{account}
form:
make: Make
make_placeholder: Toyota
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/password_resets_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PasswordResetsControllerTest < ActionDispatch::IntegrationTest
test "create" do
assert_enqueued_emails 1 do
post password_reset_path, params: { email: @user.email }
assert_redirected_to root_url
assert_redirected_to new_password_reset_url(step: "pending")
end
end

Expand Down

0 comments on commit f2739b7

Please sign in to comment.