Commit e6710a347d0801fb8130811086bb32823841127e

Authored by Arthur Esposte
Committed by Daniel
1 parent 7e2ba029

bug_fix: Fixing redirection after account activation

Now working when session is clean.

(ActionItem3096)

Signed-off-by: Arthur Del Esposte <arthurmde@gmail.com>
Signed-off-by: Daniel Bucher <daniel.bucher88@gmail.com>
Showing 1 changed file with 5 additions and 12 deletions   Show diff stats
app/controllers/public/account_controller.rb
@@ -17,7 +17,7 @@ class AccountController &lt; ApplicationController @@ -17,7 +17,7 @@ class AccountController &lt; ApplicationController
17 @user = User.find_by_activation_code(params[:activation_code]) if params[:activation_code] 17 @user = User.find_by_activation_code(params[:activation_code]) if params[:activation_code]
18 if @user and @user.activate 18 if @user and @user.activate
19 @message = _("Your account has been activated, now you can log in!") 19 @message = _("Your account has been activated, now you can log in!")
20 - session[:join] = params[:join] unless params[:join].blank? 20 + check_redirection
21 render :action => 'login', :userlogin => @user.login 21 render :action => 'login', :userlogin => @user.login
22 else 22 else
23 session[:notice] = _("It looks like you're trying to activate an account. Perhaps have already activated this account?") 23 session[:notice] = _("It looks like you're trying to activate an account. Perhaps have already activated this account?")
@@ -396,12 +396,6 @@ class AccountController &lt; ApplicationController @@ -396,12 +396,6 @@ class AccountController &lt; ApplicationController
396 end 396 end
397 397
398 def go_to_initial_page 398 def go_to_initial_page
399 - if params[:redirection]  
400 - session[:return_to] = @user.return_to  
401 - @user.return_to = nil  
402 - @user.save  
403 - end  
404 -  
405 if params[:return_to] 399 if params[:return_to]
406 redirect_to params[:return_to] 400 redirect_to params[:return_to]
407 elsif environment.enabled?('allow_change_of_redirection_after_login') 401 elsif environment.enabled?('allow_change_of_redirection_after_login')
@@ -453,11 +447,10 @@ class AccountController &lt; ApplicationController @@ -453,11 +447,10 @@ class AccountController &lt; ApplicationController
453 end 447 end
454 end 448 end
455 449
456 - def check_join_in_community(user)  
457 - profile_to_join = session[:join]  
458 - unless profile_to_join.blank?  
459 - environment.profiles.find_by_identifier(profile_to_join).add_member(user.person)  
460 - session.delete(:join) 450 + def check_redirection
  451 + unless params[:redirection].blank?
  452 + session[:return_to] = @user.return_to
  453 + @user.update_attributes(:return_to => nil)
461 end 454 end
462 end 455 end
463 end 456 end