Module: Itch::RequireAuth
- Defined in:
- lib/itch/require_auth.rb
Overview
Mixin to raise exceptions when a request redirects to login page
Instance Method Summary collapse
Instance Method Details
#require_auth(page) ⇒ Object
6 7 8 9 10 |
# File 'lib/itch/require_auth.rb', line 6 def require_auth(page) raise AuthError, "User is not logged in" if page.uri.to_s == Itch::URL::LOGIN page end |
#with_login ⇒ Object
12 13 14 |
# File 'lib/itch/require_auth.rb', line 12 def with_login require_auth yield end |