sequel_secure_password 0.2.6 → 0.2.7
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.
- checksums.yaml +4 -4
- data/lib/sequel_secure_password.rb +5 -5
- data/lib/sequel_secure_password/version.rb +1 -1
- 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: 1adc68b963c1ccd48d269c762b77db0fee66aaed
|
4
|
+
data.tar.gz: c980327dcc3ac25fe930ade11666f8f4bc534ade
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a9a77d40c73489b735d44c7eca3ee334775cd00c3ceda0265704adedfd4d014e064befcfd3ef81800340663462bcc87a39bbf572cdbe2e245192092d920beef
|
7
|
+
data.tar.gz: 5a6688e3c4d1f42de4dd10e0f36c9dc73b2e96d76455a6f0302439a89ada67b695663aa330ad428e812ce94e0ee8faa468865479e8342eb1f92d36de0d75ba59
|
@@ -4,6 +4,9 @@ require "bcrypt"
|
|
4
4
|
module Sequel
|
5
5
|
module Plugins
|
6
6
|
module SecurePassword
|
7
|
+
def self.blank_string?(string)
|
8
|
+
string.nil? or string =~ /\A\s*\z/
|
9
|
+
end
|
7
10
|
|
8
11
|
# Configure the plugin by setting the available options. Options:
|
9
12
|
# * :cost - the cost factor when creating password hash. Default:
|
@@ -25,7 +28,7 @@ module Sequel
|
|
25
28
|
|
26
29
|
def password=(unencrypted)
|
27
30
|
@password = unencrypted
|
28
|
-
unless
|
31
|
+
unless SecurePassword.blank_string? unencrypted
|
29
32
|
self.password_digest = BCrypt::Password.create(unencrypted, :cost => model.cost)
|
30
33
|
end
|
31
34
|
end
|
@@ -39,14 +42,11 @@ module Sequel
|
|
39
42
|
def validate
|
40
43
|
super
|
41
44
|
|
42
|
-
errors.add :password, 'is not present' if
|
45
|
+
errors.add :password, 'is not present' if SecurePassword.blank_string? password_digest
|
43
46
|
errors.add :password, 'has no confirmation' if password != password_confirmation
|
44
47
|
end
|
45
48
|
|
46
49
|
private
|
47
|
-
def blank?(string)
|
48
|
-
string.nil? or string =~ /\A\s*\z/
|
49
|
-
end
|
50
50
|
|
51
51
|
end
|
52
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel_secure_password
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Lenik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt
|