From b07456cc30db27bb862d53d23c69bd579a191166 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 5 Feb 2011 10:33:34 -0500 Subject: [PATCH] make openneo auth strategy a devise strategy, so it can inherit rememberable --- lib/openneo-auth/strategy.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/openneo-auth/strategy.rb b/lib/openneo-auth/strategy.rb index b303f5bb..688321a7 100644 --- a/lib/openneo-auth/strategy.rb +++ b/lib/openneo-auth/strategy.rb @@ -1,9 +1,9 @@ -require 'warden' +require 'devise' module Openneo module Auth module Strategies - class Token < Warden::Strategies::Base + class Token < Devise::Strategies::Authenticatable def valid? session && session[:session_id] end @@ -12,13 +12,16 @@ module Openneo begin auth_session = Session.find session[:session_id] rescue Session::NotFound => e - fail! e.message + pass else auth_session.destroy! - auth_session.user.remember_me! success! auth_session.user end end + + def remember_me? + true + end end end end