make openneo auth strategy a devise strategy, so it can inherit rememberable

This commit is contained in:
Emi Matchu 2011-02-05 10:33:34 -05:00
parent 8c8776ff63
commit b07456cc30

View file

@ -1,9 +1,9 @@
require 'warden' require 'devise'
module Openneo module Openneo
module Auth module Auth
module Strategies module Strategies
class Token < Warden::Strategies::Base class Token < Devise::Strategies::Authenticatable
def valid? def valid?
session && session[:session_id] session && session[:session_id]
end end
@ -12,13 +12,16 @@ module Openneo
begin begin
auth_session = Session.find session[:session_id] auth_session = Session.find session[:session_id]
rescue Session::NotFound => e rescue Session::NotFound => e
fail! e.message pass
else else
auth_session.destroy! auth_session.destroy!
auth_session.user.remember_me!
success! auth_session.user success! auth_session.user
end end
end end
def remember_me?
true
end
end end
end end
end end