Skip to content

Instantly share code, notes, and snippets.

@tibastral
Created May 8, 2011 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tibastral/961740 to your computer and use it in GitHub Desktop.
Save tibastral/961740 to your computer and use it in GitHub Desktop.
omniauth redirect back to
class StoreRedirectTo
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
path = request.path
signin = path.match(%r(^/auth/[^/]+$)) && path != '/auth/failure'
signout = path == '/users/signout'
if signin || signout
redirect = request.params['redirect_to'] || request.referer
request.session['redirect_to'] = redirect if redirect
end
@app.call(env)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment