devision 0.0.2.5 → 0.0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/devision/models/rememberable.rb +13 -2
- data/lib/devision/models/validatable.rb +11 -6
- data/lib/devision/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dc3ceded7632311f14585905ef6a4c91275dab1
|
4
|
+
data.tar.gz: f8f86b4a364d2dc707e67f96471a7d8e25c41b09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f7008856e374d058a4c8456c63769fd0f0f578be8ffd4b3f1a1c175eaf8c7bcfc77921bbb96cde2772effe95fbb302486179a3b476a7f137e2de200f039c955
|
7
|
+
data.tar.gz: 76884df834e5870bd47c29b5c73aa89b30e9ed5061a7fd3b5937eaad19a57054eb94f20e5079f5790c0fbdc4054dfb3dab7e0ec896d00ae25a1a8a7c2969d411
|
@@ -54,7 +54,7 @@ module Devision
|
|
54
54
|
def forget_me!
|
55
55
|
return unless persisted?
|
56
56
|
self.remember_token = nil if respond_to?(:remember_token=)
|
57
|
-
self.remember_created_at = nil
|
57
|
+
self.remember_created_at = nil if self.class.expire_all_remember_me_on_sign_out
|
58
58
|
save(validate: false)
|
59
59
|
end
|
60
60
|
|
@@ -99,6 +99,17 @@ module Devision
|
|
99
99
|
|
100
100
|
module ClassMethods
|
101
101
|
|
102
|
+
# create a cookie key using the record id and rememberable_value
|
103
|
+
def serialize_into_cookie(record)
|
104
|
+
[record.to_key, record.rememberable_value]
|
105
|
+
end
|
106
|
+
|
107
|
+
# Recreate the user based on the stored cookie
|
108
|
+
def serialize_from_cookie(id, rememberable_token_value)
|
109
|
+
record = to_adapter.get(id)
|
110
|
+
record if record && !record.remember_expired? && Devision.secure_compare(record.rememberable_value, rememberable_token_value)
|
111
|
+
end
|
112
|
+
|
102
113
|
# Generate a token checking if one does not already exist in the database.
|
103
114
|
def remember_token #:nodoc:
|
104
115
|
loop do
|
@@ -107,7 +118,7 @@ module Devision
|
|
107
118
|
end
|
108
119
|
end
|
109
120
|
|
110
|
-
Devision::Models::Config.add_options(self, :remember_for, :extend_remember_period, :rememberable_options)
|
121
|
+
Devision::Models::Config.add_options(self, :remember_for, :extend_remember_period, :rememberable_options, :expire_all_remember_me_on_sign_out)
|
111
122
|
end
|
112
123
|
end
|
113
124
|
end
|
@@ -10,13 +10,18 @@ module Devision
|
|
10
10
|
def self.included(base)
|
11
11
|
base.extend(ClassMethods)
|
12
12
|
base.class_eval do
|
13
|
-
validates_presence_of :email, if: :email_required?
|
14
|
-
validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
|
15
|
-
validates_format_of :email, with: email_regexp, allow_blank: true, if: :email_changed?
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
if base.instance_methods.include?(:email)
|
15
|
+
validates_presence_of :email, if: :email_required?
|
16
|
+
validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
|
17
|
+
validates_format_of :email, with: email_regexp, allow_blank: true, if: :email_changed?
|
18
|
+
end
|
19
|
+
|
20
|
+
if base.instance_methods.included?(:password)
|
21
|
+
validates_presence_of :password, if: :password_required?
|
22
|
+
validates_confirmation_of :password, if: :password_required?
|
23
|
+
validates_length_of :password, within: password_length, allow_blank: true
|
24
|
+
end
|
20
25
|
end
|
21
26
|
end
|
22
27
|
|
data/lib/devision/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devision
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2.
|
4
|
+
version: 0.0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Faucett
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|