diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb
index 59c3a35..d07b069 100644
--- a/app/controllers/public/account_controller.rb
+++ b/app/controllers/public/account_controller.rb
@@ -110,7 +110,7 @@ class AccountController < ApplicationController
check_join_in_community(@user)
go_to_signup_initial_page
else
- @register_pending = true
+ redirect_to :controller => :home, :action => :welcome
end
end
end
@@ -441,6 +441,8 @@ class AccountController < ApplicationController
redirect_to user.url
when 'user_control_panel'
redirect_to user.admin_url
+ when 'welcome_page'
+ redirect_to :controller => :home, :action => :welcome
else
redirect_back_or_default(default)
end
diff --git a/app/controllers/public/home_controller.rb b/app/controllers/public/home_controller.rb
index 3d37923..7ed1c94 100644
--- a/app/controllers/public/home_controller.rb
+++ b/app/controllers/public/home_controller.rb
@@ -18,4 +18,9 @@ class HomeController < PublicController
@no_design_blocks = true
end
+ def welcome
+ self.class.no_design_blocks
+ @display_confirmation_tips = !user.present? && !environment.enabled?(:skip_new_user_email_confirmation)
+ end
+
end
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 840a666..61b92b4 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -153,7 +153,8 @@ class Environment < ActiveRecord::Base
'site_homepage' => _('Redirects the user to the environment homepage.'),
'user_profile_page' => _('Redirects the user to his profile page.'),
'user_homepage' => _('Redirects the user to his homepage.'),
- 'user_control_panel' => _('Redirects the user to his control panel.')
+ 'user_control_panel' => _('Redirects the user to his control panel.'),
+ 'welcome_page' => _('Redirects the user to the environment welcome page.')
}
end
validates_inclusion_of :redirection_after_signup, :in => Environment.signup_redirection_options.keys, :allow_nil => true
diff --git a/app/views/account/signup.html.erb b/app/views/account/signup.html.erb
index 07ffd31..b1c388e 100644
--- a/app/views/account/signup.html.erb
+++ b/app/views/account/signup.html.erb
@@ -1,22 +1,2 @@
-<% if @register_pending %>
-
- <% if environment.has_custom_welcome_screen? %>
- <%= environment.settings[:signup_welcome_screen_body].html_safe %>
- <% else %>
-
<%= _("Welcome to %s!") % environment.name %>
-
<%= _("Thanks for signing up, we're thrilled to have you on our social network!") %>
-
<%= _("Firstly, some tips for getting started:") %>
-
<%= _("Confirm your account!") %>
-
<%= _("You should receive a welcome email from us shortly. Please take a second to follow the link within to confirm your account.") %>
-
<%= _("You won't appear as %s until your account is confirmed.") % link_to(_('user'), {:controller => :search, :action => :people, :filter => 'more_recent'}, :target => '_blank') %>
-
<%= _("What to do next?") %>
-
<%= _("%s. Upload an avatar and let your friends find you easily :)") % link_to(_('Customize your profile'), {:controller => 'doc', :section => 'user', :topic => 'editing-person-info'}, :target => '_blank') %>
-
<%= _("Learn the guidelines. Read the %s for more details on how to use this social network!") % link_to(_('Documentation'), {:controller => 'doc'}, :target => '_blank') %>
-
<%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %>
-
<%= _("Start exploring and have fun!") %>
- <% end %>
-
-<% else %>
- <%= _('Sign up for %s!') % environment.name %>
- <%= render :partial => 'signup_form' %>
-<% end %>
+<%= _('Sign up for %s!') % environment.name %>
+<%= render :partial => 'signup_form' %>
diff --git a/app/views/home/welcome.html.erb b/app/views/home/welcome.html.erb
new file mode 100644
index 0000000..58b36b0
--- /dev/null
+++ b/app/views/home/welcome.html.erb
@@ -0,0 +1,19 @@
+
+ <% if environment.has_custom_welcome_screen? %>
+ <%= environment.settings[:signup_welcome_screen_body].html_safe %>
+ <% else %>
+
<%= _("Welcome to %s!") % environment.name %>
+
<%= _("Thanks for signing up, we're thrilled to have you on our social network!") %>
+
<%= _("Firstly, some tips for getting started:") %>
+ <% if @display_confirmation_tips %>
+
<%= _("Confirm your account!") %>
+
<%= _("You should receive a welcome email from us shortly. Please take a second to follow the link within to confirm your account.") %>
+
<%= _("You won't appear as %s until your account is confirmed.") % link_to(_('user'), {:controller => :search, :action => :people, :filter => 'more_recent'}, :target => '_blank') %>
+ <% end %>
+
<%= _("What to do next?") %>
+
<%= _("%s. Upload an avatar and let your friends find you easily :)") % link_to(_('Customize your profile'), {:controller => 'doc', :section => 'user', :topic => 'editing-person-info'}, :target => '_blank') %>
+
<%= _("Learn the guidelines. Read the %s for more details on how to use this social network!") % link_to(_('Documentation'), {:controller => 'doc'}, :target => '_blank') %>
+
<%= _("%s your Gmail, Yahoo and Hotmail contacts!") % link_to(_('Invite and find'), {:controller => 'doc', :section => 'user', :topic => 'invite-contacts'}, :target => '_blank') %>
+
<%= _("Start exploring and have fun!") %>
+ <% end %>
+
diff --git a/features/signup.feature b/features/signup.feature
index da6fa8f..d9ce443 100644
--- a/features/signup.feature
+++ b/features/signup.feature
@@ -152,6 +152,21 @@ Feature: signup
Then I should be on the homepage
@selenium
+ Scenario: user should go to the environment's welcome page after signup
+ Given the environment is configured to redirect to welcome page after signup
+ And I am on /search/people
+ When I follow "Sign up"
+ And I fill in the following within ".no-boxes":
+ | e-Mail | josesilva@example.com |
+ | Username | josesilva |
+ | Password | secret |
+ | Password confirmation | secret |
+ | Full name | José da Silva |
+ And wait for the captcha signup time
+ And I press "Create my account"
+ Then I should be on the welcome page
+
+ @selenium
Scenario: user should stay on same page after following confirmation link
Given the environment is configured to stay on the same page after login
And feature "skip_new_user_email_confirmation" is disabled on environment
diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb
index 1d103ac..e2b21dc 100644
--- a/features/step_definitions/noosfero_steps.rb
+++ b/features/step_definitions/noosfero_steps.rb
@@ -745,6 +745,8 @@ Given /^the environment is configured to (.*) after signup$/ do |option|
'user_homepage'
when 'redirect to profile control panel'
'user_control_panel'
+ when 'redirect to welcome page'
+ 'welcome_page'
end
environment = Environment.default
environment.redirection_after_signup = redirection
diff --git a/features/support/paths.rb b/features/support/paths.rb
index 1765901..ea524b5 100644
--- a/features/support/paths.rb
+++ b/features/support/paths.rb
@@ -20,8 +20,8 @@ module NavigationHelpers
when /^\//
page_name
- when /^(.*)'s profile/
- '/profile/' + profile_identifier($1)
+ when /the welcome page/
+ '/site/welcome'
when /article "([^"]+)"\s*$/
url_for(Article.find_by_name($1).url.merge({:only_path => true}))
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index b2879b9..d38f855 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -50,8 +50,6 @@ class AccountControllerTest < ActionController::TestCase
def test_should_allow_signup
assert_difference 'User.count' do
new_user
- assert_response :success
- assert_not_nil assigns(:register_pending)
end
end
@@ -104,8 +102,6 @@ class AccountControllerTest < ActionController::TestCase
assert_difference 'User.count' do
Environment.default.update_attribute(:terms_of_use, 'some terms ...')
new_user(:terms_accepted => '1')
- assert_response :success
- assert_not_nil assigns(:register_pending)
end
end
@@ -626,7 +622,6 @@ class AccountControllerTest < ActionController::TestCase
Person.any_instance.stubs(:required_fields).returns(['organization'])
assert_difference 'User.count' do
post :signup, :user => { :login => 'testuser', :password => '123456', :password_confirmation => '123456', :email => 'testuser@example.com' }, :profile_data => { :organization => 'example.com' }
- assert_response :success
end
assert_equal 'example.com', Person['testuser'].organization
end
@@ -958,6 +953,14 @@ class AccountControllerTest < ActionController::TestCase
assert_equal label, "Lavras do Sul"
end
+ should 'redirect to welcome page after successful signup if environment configured as so' do
+ environment = Environment.default
+ environment.redirection_after_signup = 'welcome_page'
+ environment.save!
+ new_user
+ assert_redirected_to :controller => 'home', :action => 'welcome'
+ end
+
protected
def new_user(options = {}, extra_options ={})
data = {:profile_data => person_data}
--
libgit2 0.21.2