Module: Itch::RequireAuth

Included in:
Bundles, Game, GameMap, Purchases, Reviews, Rewards
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

Raises:



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_loginObject



12
13
14
# File 'lib/itch/require_auth.rb', line 12

def 
  require_auth yield
end