Module: Sinatra::Hancock::Sessions::Helpers
- Defined in:
- lib/sinatra/hancock/sessions.rb
Instance Method Summary collapse
Instance Method Details
#ensure_authenticated ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sinatra/hancock/sessions.rb', line 15 def ensure_authenticated if trust_root = session['hancock_server_return_to'] || params['return_to'] if ::Hancock::Consumer.allowed?(trust_root) if session_user redirect "#{trust_root}?id=#{session_user.id}" else session['hancock_server_return_to'] = trust_root end else forbidden! end end throw(:halt, [401, haml(:unauthenticated)]) unless session_user end |