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 +4 -4
- data/lib/minimalist_authentication/user.rb +11 -5
- data/lib/minimalist_authentication/version.rb +1 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d04ae5c32012e31770d8993023ef3d68e109118249bd91031b0888bc06cc9c87
|
4
|
+
data.tar.gz: f115956d42f256ddafd2f1328c688ba3a72a2e447a4bd34a182e1034d0df9d29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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
|
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
|
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
|
-
#
|
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
|
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?
|
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.
|
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:
|
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.
|
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.
|