redirect users back on registration failure
This commit is contained in:
parent
40f5314184
commit
82082005ba
2 changed files with 5 additions and 5 deletions
|
|
@ -18,10 +18,10 @@ class RegistrationsController < Devise::RegistrationsController
|
||||||
Rails.logger.info("event=registration status=successful user=#{@user.diaspora_handle}")
|
Rails.logger.info("event=registration status=successful user=#{@user.diaspora_handle}")
|
||||||
else
|
else
|
||||||
@user.errors.delete(:person)
|
@user.errors.delete(:person)
|
||||||
|
|
||||||
flash[:error] = @user.errors.full_messages.join(" - ")
|
flash[:error] = @user.errors.full_messages.join(" - ")
|
||||||
Rails.logger.info("event=registration status=failure errors='#{@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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -50,6 +50,6 @@ class RegistrationsController < Devise::RegistrationsController
|
||||||
@invite ||= InvitationCode.find_by_token(params[:invite][:token])
|
@invite ||= InvitationCode.find_by_token(params[:invite][:token])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
helper_method :invite
|
helper_method :invite
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -112,9 +112,9 @@ describe RegistrationsController do
|
||||||
flash[:error].should_not be_blank
|
flash[:error].should_not be_blank
|
||||||
end
|
end
|
||||||
|
|
||||||
it "re-renders the form" do
|
it "redirects back" do
|
||||||
get :create, @invalid_params
|
get :create, @invalid_params
|
||||||
response.should render_template("registrations/new")
|
response.should be_redirect
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue