make openneo auth strategy a devise strategy, so it can inherit rememberable
This commit is contained in:
parent
8c8776ff63
commit
b07456cc30
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue