Commit 00b43f5b7f793e3aac8a4158723190c03039a466

Authored by Aníbal Pacheco
1 parent a187b58677
Exists in master

back_url support after login using the cookie

Showing 1 changed file with 11 additions and 1 deletions Side-by-side Diff

app/controllers/saml_controller.rb View file @ 00b43f5
... ... @@ -7,6 +7,10 @@
7 7 def index
8 8 settings = Account.get_saml_settings
9 9 request = OneLogin::RubySaml::Authrequest.new
  10 + back_url = params[:back_url].to_s
  11 + if back_url.present?
  12 + cookies[:back_url] = back_url
  13 + end
10 14 redirect_to(request.create(settings))
11 15 end
12 16  
... ... @@ -23,7 +27,13 @@
23 27 cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }
24 28 end
25 29 call_hook(:controller_account_success_authentication_after, {:user => user })
26   - redirect_back_or_default :controller => 'my', :action => 'page'
  30 +
  31 + back_url = cookies[:back_url].to_s
  32 + if back_url.present?
  33 + redirect_to back_url
  34 + else
  35 + redirect_back_or_default :controller => 'my', :action => 'page'
  36 + end
27 37  
28 38 else
29 39 invalid_credentials(user)