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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa4060fe9c554b4206efc45e3ce9e3b384fbbbf5
4
- data.tar.gz: ee75911c949a2d904a3a4b0f07f94055a5bde509
3
+ metadata.gz: 2dc3ceded7632311f14585905ef6a4c91275dab1
4
+ data.tar.gz: f8f86b4a364d2dc707e67f96471a7d8e25c41b09
5
5
  SHA512:
6
- metadata.gz: ec371814cfcf088751d13577bd200f1f602cf75c0383413747e8454365cf20efe2fc8dd37bc26811e6a6d4f35b8b8515a9e4074c9f8c51786405f3aa6cc1289d
7
- data.tar.gz: a310efb8d52376c97b82286fad23b3853052a37a8beb47f41e017a7586584f99c9a4fed62e54969c136b274ca0285e4a9e572def02dcf2be08ad7235c4facfde
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
- validates_presence_of :password, if: :password_required?
18
- validates_confirmation_of :password, if: :password_required?
19
- validates_length_of :password, within: password_length, allow_blank: true
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
 
@@ -8,8 +8,8 @@ module Devision
8
8
  MAJOR = 0
9
9
  MINOR = 0
10
10
  PATCH = 2
11
- PRE = 5
11
+ PRE = 7
12
12
 
13
- STRING = [MAJOR,MINOR,PATCH,PRE].join('.').freeze
13
+ STRING = [MAJOR,MINOR,PATCH,PRE].compact.join('.').freeze
14
14
  end
15
15
  end
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.5
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-13 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler