Commit 42f790fa authored by Jonne Haß's avatar Jonne Haß

Merge pull request #4666 from jaywink/signup-form-error-redirect

Instead of redirect on signup form validation, render new
parents 76083197 35ece9d6
......@@ -64,6 +64,7 @@ For more details see https://wiki.diasporafoundation.org/Updating
* Change "Show n more comments"-link, fix [#3119](https://github.com/diaspora/diaspora/issues/3119)
* Specify Firefox version for Travis-CI [#4623](https://github.com/diaspora/diaspora/pull/4623)
* Remove location when publisher is cleared by user
* On signup form errors, don't empty previous values by user, fix [#4663](https://github.com/diaspora/diaspora/issues/4663)
## Features
* Add oEmbed content to the mobile view [#4343](https://github.com/diaspora/diaspora/pull/4353)
......
......@@ -6,7 +6,7 @@ class RegistrationsController < Devise::RegistrationsController
before_filter :check_registrations_open_or_vaild_invite!, :check_valid_invite!
layout ->(c) { request.format == :mobile ? "application" : "with_header" }, :only => [:new]
before_filter -> { @css_framework = :bootstrap }, only: [:new]
before_filter -> { @css_framework = :bootstrap }, only: [:new, :create]
def create
@user = User.build(user_params)
......@@ -22,7 +22,7 @@ class RegistrationsController < Devise::RegistrationsController
flash[:error] = @user.errors.full_messages.join(" - ")
Rails.logger.info("event=registration status=failure errors='#{@user.errors.full_messages.join(', ')}'")
redirect_to :back
render :action => 'new', :layout => 'with_header'
end
end
......
......@@ -53,6 +53,8 @@ describe RegistrationsController do
end
describe "#create" do
render_views
context "with valid parameters" do
before do
AppConfig.settings.enable_registrations = true
......@@ -107,9 +109,14 @@ describe RegistrationsController do
flash[:error].should_not be_blank
end
it "redirects back" do
it "renders new" do
get :create, @invalid_params
response.should be_redirect
expect(response).to render_template("registrations/new")
end
it "keeps invalid params in form" do
get :create, @invalid_params
expect(response.body).to match /jdoe@example.com/m
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