Commit 82082005 authored by Fabián Rodríguez's avatar Fabián Rodríguez

redirect users back on registration failure

parent 40f53141
......@@ -18,10 +18,10 @@ class RegistrationsController < Devise::RegistrationsController
Rails.logger.info("event=registration status=successful user=#{@user.diaspora_handle}")
else
@user.errors.delete(:person)
flash[:error] = @user.errors.full_messages.join(" - ")
Rails.logger.info("event=registration status=failure errors='#{@user.errors.full_messages.join(', ')}'")
render :new
redirect_to :back
end
end
......@@ -50,6 +50,6 @@ class RegistrationsController < Devise::RegistrationsController
@invite ||= InvitationCode.find_by_token(params[:invite][:token])
end
end
helper_method :invite
end
......@@ -112,9 +112,9 @@ describe RegistrationsController do
flash[:error].should_not be_blank
end
it "re-renders the form" do
it "redirects back" do
get :create, @invalid_params
response.should render_template("registrations/new")
response.should be_redirect
end
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment