devise_security_extension 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.2
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "devise_security_extension"
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marco Scholl", "Alexander Dreher"]
|
12
|
-
s.date = "2012-06-
|
12
|
+
s.date = "2012-06-12"
|
13
13
|
s.description = "An enterprise security extension for devise, trying to meet industrial standard security demands for web applications."
|
14
14
|
s.email = "team@phatworx.de"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -26,7 +26,9 @@ module Devise
|
|
26
26
|
end
|
27
27
|
|
28
28
|
if self.class.deny_old_passwords > 0 and not self.password.nil?
|
29
|
-
self.old_passwords.
|
29
|
+
old_passwords_including_cur_change = self.old_passwords.order(:id).reverse_order.limit(self.class.deny_old_passwords)
|
30
|
+
old_passwords_including_cur_change << OldPassword.new(old_password_params) # include most recent change in list, but don't save it yet!
|
31
|
+
old_passwords_including_cur_change.each do |old_password|
|
30
32
|
dummy = self.class.new
|
31
33
|
dummy.encrypted_password = old_password.encrypted_password
|
32
34
|
dummy.password_salt = old_password.password_salt if dummy.respond_to?(:password_salt)
|
@@ -36,6 +38,11 @@ module Devise
|
|
36
38
|
|
37
39
|
false
|
38
40
|
end
|
41
|
+
|
42
|
+
def password_changed_to_same?
|
43
|
+
pass_change = encrypted_password_change
|
44
|
+
pass_change && pass_change.first == pass_change.last
|
45
|
+
end
|
39
46
|
|
40
47
|
private
|
41
48
|
|
@@ -43,17 +50,20 @@ module Devise
|
|
43
50
|
def archive_password
|
44
51
|
if self.encrypted_password_changed?
|
45
52
|
if self.class.password_archiving_count.to_i > 0
|
46
|
-
|
47
|
-
|
48
|
-
else
|
49
|
-
self.old_passwords.create! :encrypted_password => self.encrypted_password_change.first
|
50
|
-
end
|
51
|
-
self.old_passwords.reverse_order(:id).offset(self.class.password_archiving_count).destroy_all
|
53
|
+
self.old_passwords.create! old_password_params
|
54
|
+
self.old_passwords.order(:id).reverse_order.offset(self.class.password_archiving_count).destroy_all
|
52
55
|
else
|
53
56
|
self.old_passwords.destroy_all
|
54
57
|
end
|
55
58
|
end
|
56
59
|
end
|
60
|
+
|
61
|
+
def old_password_params
|
62
|
+
salt_change = if self.respond_to?(:password_salt_change) and not self.password_salt_change.nil?
|
63
|
+
self.password_salt_change.first
|
64
|
+
end
|
65
|
+
{ :encrypted_password => self.encrypted_password_change.first, :password_salt => salt_change }
|
66
|
+
end
|
57
67
|
|
58
68
|
module ClassMethods
|
59
69
|
::Devise::Models.config(self, :password_archiving_count, :deny_old_passwords)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_security_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-06-
|
13
|
+
date: 2012-06-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
segments:
|
170
170
|
- 0
|
171
|
-
hash:
|
171
|
+
hash: 3787897429771212555
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
none: false
|
174
174
|
requirements:
|