Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix registration fails silently when there are errors #1455

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def create
@session = create_session_for(@user)
redirect_to root_path, notice: t(".success")
else
render :new, status: :unprocessable_entity
render :new, status: :unprocessable_entity, alert: t(".failure")
end
end

Expand Down
7 changes: 7 additions & 0 deletions app/views/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
</div>
<% end %>

<% if @user.errors.present? %>
<div class="text-red-600 flex items-center gap-2">
<%= lucide_icon "circle-alert", class: "w-5 h-5" %>
<p class="text-sm"><%= @user.errors.full_messages.to_sentence %></p>
</div>
<% end %>

<%= styled_form_with model: @user, url: registration_path, class: "space-y-4" do |form| %>
<%= form.email_field :email,
autofocus: false,
Expand Down
1 change: 1 addition & 0 deletions config/locales/views/registrations/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ en:
create:
invalid_invite_code: Invalid invite code, please try again.
success: You have signed up successfully.
failure: There was a problem signing up.
new:
invitation_message: "%{inviter} has invited you to join as a %{role}"
join_family_title: Join %{family}
Expand Down