Class: QuoVadis::Constraints::LoggedIn

Inherits:
Object
  • Object
show all
Defined in:
lib/quo_vadis/constraints/logged_in.rb

Class Method Summary collapse

Class Method Details

.matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
# File 'lib/quo_vadis/constraints/logged_in.rb', line 5

def self.matches?(request)
  cookies = ActionDispatch::Cookies::CookieJar.build(request, request.cookies)
  session_id = cookies.encrypted[QuoVadis.cookie_name]
  session_id && QuoVadis::Session.find_by(id: session_id)
end