sequel_secure_password 0.2.6 → 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: 8f3d995feefac5490bcd6c2af0e7b2860d278b7b
4
- data.tar.gz: e1c6b73f6e9dd97501cab49aa4d1d787a7697f4f
3
+ metadata.gz: 1adc68b963c1ccd48d269c762b77db0fee66aaed
4
+ data.tar.gz: c980327dcc3ac25fe930ade11666f8f4bc534ade
5
5
  SHA512:
6
- metadata.gz: 1cbad57e09d182aed65b111a7ea1b114250a74e9fe57fb054704a629d479b837d345081f1155878c8d41f2372e7c567dad3fae7407cd68183ca6a24c7bc14846
7
- data.tar.gz: 74c9cd22f36afd8a39dc83fd1002b00d0708e82b8dc3336023491206369a70d7e028511f15d2afc5cc6386bc5bbb17496cd9439d07685097ce3ddbfb5577ca34
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 blank? unencrypted
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 blank? password_digest
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
@@ -1,3 +1,3 @@
1
1
  module SequelSecurePassword
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  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.6
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-27 00:00:00.000000000 Z
11
+ date: 2014-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt