vizjerai-devise_security_extension 0.3.4 → 0.3.5
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.3.
|
1
|
+
0.3.5
|
@@ -21,7 +21,7 @@ module Devise
|
|
21
21
|
base.class_eval do
|
22
22
|
|
23
23
|
# uniq login
|
24
|
-
validates authentication_keys[0], :uniqueness => {:scope => authentication_keys[1..-1]}#, :case_sensitive => case_insensitive_keys.exclude?(authentication_keys[0])
|
24
|
+
validates authentication_keys[0], :uniqueness => {:scope => authentication_keys[1..-1]} #, :case_sensitive => case_insensitive_keys.exclude?(authentication_keys[0])
|
25
25
|
|
26
26
|
# validates email
|
27
27
|
validates :email, :presence => true, :if => :email_required?
|
@@ -29,6 +29,9 @@ module Devise
|
|
29
29
|
|
30
30
|
# validates password
|
31
31
|
validates :password, :presence => true, :length => password_length, :format => password_regex, :confirmation => true, :if => :password_required?
|
32
|
+
|
33
|
+
# don't allow use same password
|
34
|
+
validate :current_equal_password_validation
|
32
35
|
end
|
33
36
|
end
|
34
37
|
|
@@ -36,6 +39,13 @@ module Devise
|
|
36
39
|
raise "Could not use SecureValidatable on #{base}" unless base.respond_to?(:validates)
|
37
40
|
end
|
38
41
|
|
42
|
+
def current_equal_password_validation
|
43
|
+
dummy = self.class.new
|
44
|
+
dummy.encrypted_password = self.encrypted_password
|
45
|
+
dummy.password_salt = self.password_salt
|
46
|
+
self.errors.add(:password, :equal_to_current_password) if dummy.valid_password?(self.password)
|
47
|
+
end
|
48
|
+
|
39
49
|
protected
|
40
50
|
|
41
51
|
# Checks whether a password is needed or not. For validations only.
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{vizjerai-devise_security_extension}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.5"
|
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"]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vizjerai-devise_security_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 5
|
10
|
+
version: 0.3.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marco Scholl
|