module Itch::RequireAuth

Mixin to raise exceptions when a request redirects to login page

Public Instance Methods

require_auth(page) click to toggle source
# 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() { || ... } click to toggle source
# File lib/itch/require_auth.rb, line 12
def with_login
  require_auth yield
end