support return_to after logout
authorTom Clegg <tom@clinicalfuture.com>
Fri, 1 Feb 2013 05:57:31 +0000 (21:57 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Fri, 1 Feb 2013 05:57:31 +0000 (21:57 -0800)
app/controllers/user_sessions_controller.rb

index f941cb065329e293de2de7351118b5f71cbed57a..1e61392f5f85beb856a3f70900af28d0595b75f1 100644 (file)
@@ -64,7 +64,8 @@ class UserSessionsController < ApplicationController
     session[:user_id] = nil
 
     flash[:notice] = 'You have logged off'
-    redirect_to "#{CUSTOM_PROVIDER_URL}/users/sign_out?redirect_uri=#{root_url}"
+    return_to = params[:return_to] || root_url
+    redirect_to "#{CUSTOM_PROVIDER_URL}/users/sign_out?redirect_uri=#{CGI.escape return_to}"
   end
 
   # login - Just bounce to /auth/joshid. The only purpose of this function is