diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index b5613d44..128b309c 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -28,7 +28,7 @@ class RegistrationsController < ApplicationController @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 diff --git a/app/views/registrations/new.html.erb b/app/views/registrations/new.html.erb index 1c0f3fe7..855888a7 100644 --- a/app/views/registrations/new.html.erb +++ b/app/views/registrations/new.html.erb @@ -17,6 +17,13 @@ <% end %> +<% if @user.errors.present? %> +
+ <%= lucide_icon "circle-alert", class: "w-5 h-5" %> +

<%= @user.errors.full_messages.to_sentence %>

+
+<% end %> + <%= styled_form_with model: @user, url: registration_path, class: "space-y-4" do |form| %> <%= form.email_field :email, autofocus: false, @@ -25,7 +32,7 @@ placeholder: "you@example.com", label: true, disabled: @invitation.present? %> - <%= form.password_field :password, autocomplete: "new-password", required: "required", label: true %> + <%= form.password_field :password, autocomplete: "new-password", required: "required", label: true, maxlength: 72 %> <%= form.password_field :password_confirmation, autocomplete: "new-password", required: "required", label: true %> <% if invite_code_required? && !@invitation %> <%= form.text_field :invite_code, required: "required", label: true, value: params[:invite] %> diff --git a/config/locales/views/registrations/en.yml b/config/locales/views/registrations/en.yml index 7468f909..cf4b77f2 100644 --- a/config/locales/views/registrations/en.yml +++ b/config/locales/views/registrations/en.yml @@ -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}