Class: QuoVadis::Constraints::LoggedOut

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

Class Method Summary collapse

Class Method Details

.matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


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

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