minimalist_authentication 3.4.1 → 3.4.2

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: 79d61a668a0923babb9c46da034f262af4dc8ed449b511bb44427b2c1af202c4
4
- data.tar.gz: b6e226a4f03b89609870b4841bfa83cbb781eb3b1ffc2c7d201c4e99328a4921
3
+ metadata.gz: 81a22051077302595ad7912895d76c53f850e9b29e1dab723fdae137fefea9ac
4
+ data.tar.gz: 6c5343b7605ca25829c7744ffff968389d8cf306dd3bb4fe7d368ed226e87995
5
5
  SHA512:
6
- metadata.gz: '09a6e851dd57f8541116348298da3e1d5b2227f40a03ae3aed99a75040b30d237f5641741bfbad5b2fee73daaf9e1f2951634f263adc2a4827dc3bf5220307d7'
7
- data.tar.gz: d47f8f2afa9464bce14cc503a64850dacf774bdd50ca965f4077e808afbb51f6ee8e4f1dc4877a9769fac7ff26b19cb77a6ad05828564a9436a692730be83a2f
6
+ metadata.gz: 0b6b0e178491e11fc0337068aa5c21b02644ec716fd5d8818f9d0598e40cc6d476f3285f8ef8d8c193f0342debd32460edca76d578d27e16f79d5ea333a36389
7
+ data.tar.gz: 53f72000d43f6620d061f96c65274dc710a853f8ec58ebcd1cc42f46d95de31c4ff989d635077b0315baeb539d2a653dcd68c0335e940c71631884e3572136cf
@@ -37,7 +37,7 @@ class PasswordResetsController < ApplicationController
37
37
  end
38
38
 
39
39
  def user
40
- MinimalistAuthentication.user_model.active.find_by(email:)
40
+ MinimalistAuthentication.user_model.find_enabled_by(email:)
41
41
  end
42
42
 
43
43
  def email_valid?
@@ -30,6 +30,10 @@ module MinimalistAuthentication
30
30
  )
31
31
  end
32
32
 
33
+ def ma_email_verification_button(**)
34
+ button_to(t(".button"), email_verification_path, **)
35
+ end
36
+
33
37
  def ma_forgot_password_link
34
38
  link_to(t(".forgot_password"), new_password_reset_path)
35
39
  end
@@ -40,7 +44,7 @@ module MinimalistAuthentication
40
44
  options.reverse_merge(
41
45
  autocomplete: "new-password",
42
46
  minlength: MinimalistAuthentication.user_model.password_minimum,
43
- placeholder: true,
47
+ placeholder: "New password",
44
48
  required: true
45
49
  )
46
50
  )
@@ -72,5 +76,9 @@ module MinimalistAuthentication
72
76
  )
73
77
  )
74
78
  end
79
+
80
+ def ma_verification_message(user = current_user)
81
+ render(user.email_verified? ? "verified" : "unverified")
82
+ end
75
83
  end
76
84
  end
@@ -0,0 +1 @@
1
+ <h2><%= t(".message") %></h2>
@@ -0,0 +1 @@
1
+ <h2><%= t(".message") %></h2>
@@ -1,12 +1,14 @@
1
- <h2><%= t(".title") %></h2>
1
+ <h1><%= t(".title") %></h1>
2
+
3
+ <h2><%= t(".instructions") %></h2>
4
+
5
+ <p><%= t(".message") %></p>
2
6
 
3
7
  <p>
4
8
  <strong><%= current_user.email %></strong>
5
9
  <em><%= ma_change_email_link %></em>
6
10
  </p>
7
11
 
8
- <%= button_to t(".button"), email_verification_path %>
9
-
10
- <p><%= t(".message") %></p>
12
+ <%= ma_email_verification_button %>
11
13
 
12
14
  <%= ma_skip_link %>
@@ -1,10 +1,6 @@
1
- <h1>Email Verification</h1>
1
+ <h1><%= t(".title") %></h1>
2
2
 
3
- <% if current_user.email_verified? %>
4
- <h2>Your email address has been verified</h2>
5
- <% else %>
6
- <h2>Email address verification failed</h2>
7
- <% end %>
8
- <h2><%= current_user.email %></h2>
3
+ <%= ma_verification_message %>
4
+ <p><%= current_user.email %></p>
9
5
 
10
6
  <%= link_to("Go to Dashboard", dashboard_path) %>
@@ -4,8 +4,15 @@ en:
4
4
  notice: Verification email sent to %{email}, follow the instructions to complete verification. Thank you!
5
5
  new:
6
6
  button: Send Verification Email
7
+ instructions: Please verify your email address
7
8
  message: Verifying your email will allow you to receive confidential messages.
8
- title: Please verify your email address
9
+ title: Email Verification
10
+ show:
11
+ title: Email Verification
12
+ unverified:
13
+ message: Email address verification failed
14
+ verified:
15
+ message: Your email address has been verified
9
16
  emails:
10
17
  edit:
11
18
  instructions: Please update your email address
@@ -49,10 +49,15 @@ module MinimalistAuthentication
49
49
  module ClassMethods
50
50
  delegate :account_setup_duration, :password_reset_duration, to: "MinimalistAuthentication.configuration"
51
51
 
52
- # Finds a user by their id and returns the user if they are enabled.
53
- # Returns nil if the user is not found or not enabled.
52
+ # Finds an enabled user by id.
54
53
  def find_enabled(id)
55
- find_by(id:)&.enabled if id.present?
54
+ find_enabled_by(id:) if id.present?
55
+ end
56
+
57
+ # Finds a user matching the specified conditions and returns the user if they are enabled.
58
+ # Returns nil if a user is not found or not enabled.
59
+ def find_enabled_by(**)
60
+ find_by(**)&.enabled
56
61
  end
57
62
 
58
63
  def inactive
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MinimalistAuthentication
4
- VERSION = "3.4.1"
4
+ VERSION = "3.4.2"
5
5
  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: 3.4.1
4
+ version: 3.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Baldwin
@@ -10,6 +10,34 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: actionmailer
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 7.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 7.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: activerecord
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 7.1.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 7.1.0
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bcrypt
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -31,7 +59,7 @@ dependencies:
31
59
  - !ruby/object:Gem::Version
32
60
  version: 3.1.3
33
61
  - !ruby/object:Gem::Dependency
34
- name: rails
62
+ name: railties
35
63
  requirement: !ruby/object:Gem::Requirement
36
64
  requirements:
37
65
  - - ">="
@@ -63,6 +91,8 @@ files:
63
91
  - app/mailers/application_mailer.rb
64
92
  - app/mailers/minimalist_authentication_mailer.rb
65
93
  - app/validators/password_exclusivity_validator.rb
94
+ - app/views/email_verifications/_unverified.html.erb
95
+ - app/views/email_verifications/_verified.html.erb
66
96
  - app/views/email_verifications/new.html.erb
67
97
  - app/views/email_verifications/show.html.erb
68
98
  - app/views/emails/edit.html.erb
@@ -112,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
142
  - !ruby/object:Gem::Version
113
143
  version: '0'
114
144
  requirements: []
115
- rubygems_version: 3.7.2
145
+ rubygems_version: 4.0.2
116
146
  specification_version: 4
117
147
  summary: A Rails authentication plugin that takes a minimalist approach.
118
148
  test_files: []