redirect to first_login page for all new users to set accessibility mode

pull/1121/head
kgalli 11 years ago committed by Michael Frister
parent d16e062b41
commit 35c334c6c5
  1. 20
      app/controllers/account_controller.rb

@ -273,14 +273,7 @@ class AccountController < ApplicationController
end end
call_hook(:controller_account_success_authentication_after, {:user => user }) call_hook(:controller_account_success_authentication_after, {:user => user })
if user.first_login redirect_according_to_first_login(user)
user.update_attribute(:first_login, false)
redirect_to :controller => "/my", :action => "first_login", :back_url => params[:back_url]
else
redirect_back_or_default :controller => '/my', :action => 'page'
end
end end
def set_autologin_cookie(user) def set_autologin_cookie(user)
@ -386,7 +379,7 @@ class AccountController < ApplicationController
if user.save if user.save
self.logged_user = user self.logged_user = user
flash[:notice] = l(:notice_account_activated) flash[:notice] = l(:notice_account_activated)
redirect_to :controller => '/my', :action => 'account' redirect_according_to_first_login(user)
else else
yield if block_given? yield if block_given?
end end
@ -412,4 +405,13 @@ class AccountController < ApplicationController
flash[:notice] = l(:notice_account_pending) flash[:notice] = l(:notice_account_pending)
redirect_to :action => 'login' redirect_to :action => 'login'
end end
def redirect_according_to_first_login(user)
if user.first_login
user.update_attribute(:first_login, false)
redirect_to :controller => "/my", :action => "first_login", :back_url => params[:back_url]
else
redirect_back_or_default :controller => '/my', :action => 'page'
end
end
end end

Loading…
Cancel
Save