minimalist_authentication 2.2.2 → 2.3.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd72c9f17536ef24bfc7d134733d03a00f1c235d5708b01dc2d5f415a484a688
|
4
|
+
data.tar.gz: 0501ccbf2663bf59d5a18ebb45566de7e04739b48ebda46ce6f0a5efa5ff0c78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1bb394153abcb693310c2d78a0d75385730accf41296e0871a86f15522a37db365bf09b41f94e092f4ab50be37b26765c0d91f93b88fcee6555d8737c4c38ab
|
7
|
+
data.tar.gz: aa4b2745cb630582b9c86a42aead66bd12b3be68d14c64f13d99f8cbbbd50423fc9820ba76bf84093503d84746d7046bb3823e421c3dc9d764f13e130c94f9d2
|
@@ -15,16 +15,17 @@ class PasswordResetsController < ApplicationController
|
|
15
15
|
MinimalistAuthenticationMailer.update_password(user).deliver_now
|
16
16
|
end
|
17
17
|
# always display notice even if the user was not found to prevent leaking user emails
|
18
|
-
redirect_to new_session_path, notice: "Password reset instructions were mailed to #{
|
18
|
+
redirect_to new_session_path, notice: "Password reset instructions were mailed to #{email}"
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
23
|
def user
|
24
|
-
|
24
|
+
return unless URI::MailTo::EMAIL_REGEXP.match?(email)
|
25
|
+
@user ||= MinimalistAuthentication.configuration.user_model.active.email_verified.find_by(email: email)
|
25
26
|
end
|
26
27
|
|
27
|
-
def
|
28
|
-
params.require(:user).
|
28
|
+
def email
|
29
|
+
params.require(:user).fetch(:email)
|
29
30
|
end
|
30
31
|
end
|
@@ -17,7 +17,8 @@ module MinimalistAuthentication
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def get_user_from_session
|
20
|
-
|
20
|
+
return unless session_user_id
|
21
|
+
MinimalistAuthentication.configuration.user_model.active.find_by(id: session_user_id)
|
21
22
|
end
|
22
23
|
|
23
24
|
def session_user_id
|
@@ -5,7 +5,6 @@ module MinimalistAuthentication
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
GUEST_USER_EMAIL = 'guest'
|
8
|
-
EMAIL_REGEX = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
|
9
8
|
PASSWORD_MIN = 8
|
10
9
|
PASSWORD_MAX = 40
|
11
10
|
|
@@ -20,14 +19,22 @@ module MinimalistAuthentication
|
|
20
19
|
before_save :hash_password
|
21
20
|
|
22
21
|
# Email validations
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
validates(
|
23
|
+
:email,
|
24
|
+
format: { allow_blank: true, with: URI::MailTo::EMAIL_REGEXP },
|
25
|
+
uniqueness: { allow_blank: true, case_sensitive: false, scope: :active },
|
26
|
+
if: :validate_email?
|
27
|
+
)
|
28
|
+
validates(:email, presence: true, if: :validate_email_presence?)
|
26
29
|
|
27
30
|
# Password validations
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
+
validates(
|
32
|
+
:password,
|
33
|
+
confirmation: true,
|
34
|
+
length: { within: PASSWORD_MIN..PASSWORD_MAX },
|
35
|
+
presence: true,
|
36
|
+
if: :validate_password?
|
37
|
+
)
|
31
38
|
|
32
39
|
# Active scope
|
33
40
|
scope :active, ->(state = true) { where(active: state) }
|
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.
|
4
|
+
version: 2.3.0
|
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: 2022-08-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.3.9
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: A Rails authentication plugin that takes a minimalist approach.
|