minimalist_authentication 2.2.1 → 2.2.2

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
  SHA256:
3
- metadata.gz: 7393c90dec001c1a5cc41a7671335a14525c2df82b5b1ef6f09695d0f5eb618d
4
- data.tar.gz: 5938f2b31f6139096fd59b4c2257d6056b216d276e4d4cfbad5c67edd34cbed5
3
+ metadata.gz: d04ae5c32012e31770d8993023ef3d68e109118249bd91031b0888bc06cc9c87
4
+ data.tar.gz: f115956d42f256ddafd2f1328c688ba3a72a2e447a4bd34a182e1034d0df9d29
5
5
  SHA512:
6
- metadata.gz: f84a1b08c525c57f5974d7d73f7eba50835952ea29ff8f9336d2e31af53a92074f59cb319002ab6647dddeab6cb126077cb92a01c5349a6ad5a1980e4c4c75d4
7
- data.tar.gz: 75636fe9e427511d02809c232fd6bb6692fa5bdad2db564391ce5e97a4d8cecee149f836330849f006c8d470509f283b6c641812967dbedac058464ead0d47c5
6
+ metadata.gz: 43a655bede1179250c8f43410b239a4ae23ca07a80a0e7c2e65f0903ea9bf07772565026dc7b254c116f42682572a305e7bcd21a35a1049bde548fb48adddb99
7
+ data.tar.gz: dbf795a8be4b6fe6e6fc6f10b17f7d12587aa15db58232f4d3bd87c985ce4f7a9d43cbe5b8d9451b227524ce477597b8f0d1bec67e24e94d374f57e769923bf0
@@ -30,16 +30,17 @@ module MinimalistAuthentication
30
30
  validates_length_of :password, within: PASSWORD_MIN..PASSWORD_MAX, if: :validate_password?
31
31
 
32
32
  # Active scope
33
- scope :active, ->(active = true) { where active: active }
33
+ scope :active, ->(state = true) { where(active: state) }
34
+ scope :inactive, -> { active(false) }
34
35
  end
35
36
 
36
37
  module ClassMethods
37
38
  # Authenticates a user form the params provided. Expects a params hash with
38
- # email or username and passwod keys.
39
+ # email or username and password keys.
39
40
  # Params examples:
40
41
  # { email: 'user@example.com', password: 'abc123' }
41
42
  # { username: 'user', password: 'abc123' }
42
- # Returns user upon successful authentcation.
43
+ # Returns user upon successful authentication.
43
44
  # Otherwise returns nil.
44
45
  def authenticate(params)
45
46
  # extract email or username and the associated value
@@ -65,6 +66,11 @@ module MinimalistAuthentication
65
66
  active
66
67
  end
67
68
 
69
+ # Returns true if the user is not active.
70
+ def inactive?
71
+ !active
72
+ end
73
+
68
74
  # Return true if password matches the hashed_password.
69
75
  # If successful checks for an outdated password_hash and updates if
70
76
  # necessary.
@@ -107,7 +113,7 @@ module MinimalistAuthentication
107
113
  Password.new(password_hash)
108
114
  end
109
115
 
110
- # Requre password for active users that either do no have a password hash
116
+ # Require password for active users that either do no have a password hash
111
117
  # stored OR are attempting to set a new password. Set **password_required**
112
118
  # to true to force validations even when the password field is blank.
113
119
  def validate_password?
@@ -122,7 +128,7 @@ module MinimalistAuthentication
122
128
  end
123
129
 
124
130
  # Validate email presence for active users.
125
- # Applications can turn offf email presence validation by setting
131
+ # Applications can turn off email presence validation by setting
126
132
  # validate_email_presence configuration attribute to false.
127
133
  def validate_email_presence?
128
134
  MinimalistAuthentication.configuration.validate_email_presence && validate_email?
@@ -1,3 +1,3 @@
1
1
  module MinimalistAuthentication
2
- VERSION = '2.2.1'
2
+ VERSION = '2.2.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimalist_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Baldwin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-08-28 00:00:00.000000000 Z
12
+ date: 2021-08-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -45,20 +45,6 @@ dependencies:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 3.1.3
48
- - !ruby/object:Gem::Dependency
49
- name: loofah
50
- requirement: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 2.3.1
55
- type: :runtime
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: 2.3.1
62
48
  - !ruby/object:Gem::Dependency
63
49
  name: sqlite3
64
50
  requirement: !ruby/object:Gem::Requirement
@@ -139,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
125
  - !ruby/object:Gem::Version
140
126
  version: '0'
141
127
  requirements: []
142
- rubygems_version: 3.1.2
128
+ rubygems_version: 3.2.26
143
129
  signing_key:
144
130
  specification_version: 4
145
131
  summary: A Rails authentication plugin that takes a minimalist approach.