mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Temporary fix for 3-1-stable that does not implement key? on cookie jar, closes #1179
This commit is contained in:
parent
82ae53dd75
commit
5a98e4f4e8
3 changed files with 13 additions and 4 deletions
|
@ -1,3 +1,6 @@
|
|||
* bug fix
|
||||
* Improve Rails 3.1 compatibility
|
||||
|
||||
== 1.4.1
|
||||
|
||||
* enhancements
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
devise (1.4.0)
|
||||
devise (1.4.1)
|
||||
bcrypt-ruby (~> 2.1.2)
|
||||
orm_adapter (~> 0.0.3)
|
||||
warden (~> 1.0.3)
|
||||
|
@ -91,7 +91,7 @@ GEM
|
|||
oauth2 (0.1.1)
|
||||
faraday (~> 0.5.0)
|
||||
multi_json (~> 0.0.4)
|
||||
orm_adapter (0.0.4)
|
||||
orm_adapter (0.0.5)
|
||||
polyglot (0.3.1)
|
||||
rack (1.2.2)
|
||||
rack-mount (0.6.14)
|
||||
|
|
|
@ -9,14 +9,15 @@ module Devise
|
|||
class Rememberable < Authenticatable
|
||||
# A valid strategy for rememberable needs a remember token in the cookies.
|
||||
def valid?
|
||||
cookies.key?(remember_key)
|
||||
@remember_cookie = nil
|
||||
remember_cookie.present?
|
||||
end
|
||||
|
||||
# To authenticate a user we deserialize the cookie and attempt finding
|
||||
# the record in the database. If the attempt fails, we pass to another
|
||||
# strategy handle the authentication.
|
||||
def authenticate!
|
||||
resource = mapping.to.serialize_from_cookie(*cookies.signed[remember_key])
|
||||
resource = mapping.to.serialize_from_cookie(*remember_cookie)
|
||||
|
||||
if validate(resource)
|
||||
success!(resource)
|
||||
|
@ -40,6 +41,11 @@ module Devise
|
|||
def remember_key
|
||||
"remember_#{scope}_token"
|
||||
end
|
||||
|
||||
def remember_cookie
|
||||
@remember_cookie ||= cookies.signed[remember_key]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue