rodauth-rails 1.4.1 → 1.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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +1 -1
- data/lib/generators/rodauth/templates/app/mailers/rodauth_mailer.rb +38 -52
- data/lib/generators/rodauth/templates/app/misc/rodauth_main.rb +6 -6
- data/lib/generators/rodauth/templates/app/models/account.rb +1 -0
- data/lib/generators/rodauth/templates/app/views/rodauth_mailer/verify_login_change.text.erb +2 -2
- data/lib/rodauth/rails/version.rb +1 -1
- data/rodauth-rails.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a42fbc8522feb0a7d18227ca1cb3d79448c6d5d824befb040699afdb69318ea
|
4
|
+
data.tar.gz: 4d60492cc1ea2acf8176ffb6a05c6f0aba7deda63d1541da42de7f558e55b6e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8782debac4a0b3bea9bb1849ab0817966f62c3bcf0cf352c2cf83d68e0fc35bce83a321e8c49f96d027450b87d6c196afd1e451a6e79e53cd35328dd84893d8c
|
7
|
+
data.tar.gz: 24de3dec4d061a9421de53062d75959d67091aff43dc26bf7f7fd749664e2288a4a9c198f24fa4ce8890b0c88f38c294d85a565b09aae330c0bcf7674242f112
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 1.4.2 (2022-05-15)
|
2
|
+
|
3
|
+
* Stop passing email addresses in mailer arguments on verifying login change (@janko)
|
4
|
+
|
5
|
+
* Extract finding account into a method in the generated mailer (@janko)
|
6
|
+
|
7
|
+
* Make generated Action Mailer integration work with secondary Rodauth configurations (@janko)
|
8
|
+
|
9
|
+
* Include `Rodauth::Rails.model` in generated Sequel account model as well (@janko)
|
10
|
+
|
1
11
|
## 1.4.1 (2022-05-08)
|
2
12
|
|
3
13
|
* Deprecate `Rodauth::Rails::Model` constant (@janko)
|
data/README.md
CHANGED
@@ -489,7 +489,7 @@ into the account model, which defines a password attribute and associations for
|
|
489
489
|
tables used by enabled authentication features.
|
490
490
|
|
491
491
|
```rb
|
492
|
-
class Account <
|
492
|
+
class Account < ActiveRecord::Base # Sequel::Model
|
493
493
|
include Rodauth::Rails.model # or `Rodauth::Rails.model(:admin)`
|
494
494
|
end
|
495
495
|
```
|
@@ -1,78 +1,64 @@
|
|
1
1
|
class RodauthMailer < ApplicationMailer
|
2
|
-
def verify_account(account_id, key)
|
3
|
-
@email_link =
|
4
|
-
|
5
|
-
@account = Account.find(account_id)
|
6
|
-
<% else -%>
|
7
|
-
@account = Account.with_pk!(account_id)
|
8
|
-
<% end -%>
|
2
|
+
def verify_account(name = nil, account_id, key)
|
3
|
+
@email_link = email_link(name, :verify_account, account_id, key)
|
4
|
+
@account = find_account(name, account_id)
|
9
5
|
|
10
|
-
mail to: @account.email, subject: rodauth.verify_account_email_subject
|
6
|
+
mail to: @account.email, subject: rodauth(name).verify_account_email_subject
|
11
7
|
end
|
12
8
|
|
13
|
-
def reset_password(account_id, key)
|
14
|
-
@email_link =
|
15
|
-
|
16
|
-
@account = Account.find(account_id)
|
17
|
-
<% else -%>
|
18
|
-
@account = Account.with_pk!(account_id)
|
19
|
-
<% end -%>
|
9
|
+
def reset_password(name = nil, account_id, key)
|
10
|
+
@email_link = email_link(name, :reset_password, account_id, key)
|
11
|
+
@account = find_account(name, account_id)
|
20
12
|
|
21
|
-
mail to: @account.email, subject: rodauth.reset_password_email_subject
|
13
|
+
mail to: @account.email, subject: rodauth(name).reset_password_email_subject
|
22
14
|
end
|
23
15
|
|
24
|
-
def verify_login_change(
|
25
|
-
@
|
26
|
-
@
|
27
|
-
@
|
28
|
-
<% if defined?(ActiveRecord::Railtie) -%>
|
29
|
-
@account = Account.find(account_id)
|
30
|
-
<% else -%>
|
31
|
-
@account = Account.with_pk!(account_id)
|
32
|
-
<% end -%>
|
16
|
+
def verify_login_change(name = nil, account_id, key)
|
17
|
+
@email_link = email_link(name, :verify_login_change, account_id, key)
|
18
|
+
@account = find_account(name, account_id)
|
19
|
+
@new_email = @account.login_change_key.login
|
33
20
|
|
34
|
-
mail to:
|
21
|
+
mail to: @new_email, subject: rodauth(name).verify_login_change_email_subject
|
35
22
|
end
|
36
23
|
|
37
|
-
def password_changed(account_id)
|
38
|
-
|
39
|
-
@account = Account.find(account_id)
|
40
|
-
<% else -%>
|
41
|
-
@account = Account.with_pk!(account_id)
|
42
|
-
<% end -%>
|
24
|
+
def password_changed(name = nil, account_id)
|
25
|
+
@account = find_account(name, account_id)
|
43
26
|
|
44
|
-
mail to: @account.email, subject: rodauth.password_changed_email_subject
|
27
|
+
mail to: @account.email, subject: rodauth(name).password_changed_email_subject
|
45
28
|
end
|
46
29
|
|
47
|
-
# def email_auth(account_id, key)
|
48
|
-
# @email_link =
|
49
|
-
|
50
|
-
# @account = Account.find(account_id)
|
51
|
-
<% else -%>
|
52
|
-
# @account = Account.with_pk!(account_id)
|
53
|
-
<% end -%>
|
30
|
+
# def email_auth(name = nil, account_id, key)
|
31
|
+
# @email_link = email_link(name, :email_auth, account_id, key)
|
32
|
+
# @account = find_account(name, account_id)
|
54
33
|
|
55
|
-
# mail to: @account.email, subject: rodauth.email_auth_email_subject
|
34
|
+
# mail to: @account.email, subject: rodauth(name).email_auth_email_subject
|
56
35
|
# end
|
57
36
|
|
58
|
-
# def unlock_account(account_id, key)
|
59
|
-
# @email_link =
|
60
|
-
|
61
|
-
# @account = Account.find(account_id)
|
62
|
-
<% else -%>
|
63
|
-
# @account = Account.with_pk!(account_id)
|
64
|
-
<% end -%>
|
37
|
+
# def unlock_account(name = nil, account_id, key)
|
38
|
+
# @email_link = email_link(name, :unlock_account, account_id, key)
|
39
|
+
# @account = find_account(name, account_id)
|
65
40
|
|
66
|
-
# mail to: @account.email, subject: rodauth.unlock_account_email_subject
|
41
|
+
# mail to: @account.email, subject: rodauth(name).unlock_account_email_subject
|
67
42
|
# end
|
68
43
|
|
69
44
|
private
|
70
45
|
|
71
|
-
def
|
72
|
-
|
46
|
+
def find_account(_name, account_id)
|
47
|
+
<% if defined?(ActiveRecord::Railtie) -%>
|
48
|
+
Account.find(account_id)
|
49
|
+
<% else -%>
|
50
|
+
Account.with_pk!(account_id)
|
51
|
+
<% end -%>
|
52
|
+
end
|
53
|
+
|
54
|
+
def email_link(name, action, account_id, key)
|
55
|
+
instance = rodauth(name)
|
56
|
+
instance.instance_variable_set(:@account, { id: account_id })
|
57
|
+
instance.instance_variable_set(:"@#{action}_key_value", key)
|
58
|
+
instance.public_send(:"#{action}_email_link")
|
73
59
|
end
|
74
60
|
|
75
|
-
def rodauth(name
|
61
|
+
def rodauth(name)
|
76
62
|
RodauthApp.rodauth(name).allocate
|
77
63
|
end
|
78
64
|
end
|
@@ -56,22 +56,22 @@ class RodauthMain < Rodauth::Rails::Auth
|
|
56
56
|
# ==> Emails
|
57
57
|
# Use a custom mailer for delivering authentication emails.
|
58
58
|
create_reset_password_email do
|
59
|
-
RodauthMailer.reset_password(account_id, reset_password_key_value)
|
59
|
+
RodauthMailer.reset_password(*self.class.configuration_name, account_id, reset_password_key_value)
|
60
60
|
end
|
61
61
|
create_verify_account_email do
|
62
|
-
RodauthMailer.verify_account(account_id, verify_account_key_value)
|
62
|
+
RodauthMailer.verify_account(*self.class.configuration_name, account_id, verify_account_key_value)
|
63
63
|
end
|
64
64
|
create_verify_login_change_email do |_login|
|
65
|
-
RodauthMailer.verify_login_change(
|
65
|
+
RodauthMailer.verify_login_change(*self.class.configuration_name, account_id, verify_login_change_key_value)
|
66
66
|
end
|
67
67
|
create_password_changed_email do
|
68
|
-
RodauthMailer.password_changed(account_id)
|
68
|
+
RodauthMailer.password_changed(*self.class.configuration_name, account_id)
|
69
69
|
end
|
70
70
|
# create_email_auth_email do
|
71
|
-
# RodauthMailer.email_auth(account_id, email_auth_key_value)
|
71
|
+
# RodauthMailer.email_auth(*self.class.configuration_name, account_id, email_auth_key_value)
|
72
72
|
# end
|
73
73
|
# create_unlock_account_email do
|
74
|
-
# RodauthMailer.unlock_account(account_id, unlock_account_key_value)
|
74
|
+
# RodauthMailer.unlock_account(*self.class.configuration_name, account_id, unlock_account_key_value)
|
75
75
|
# end
|
76
76
|
send_email do |email|
|
77
77
|
# queue email delivery on the mailer after the transaction commits
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Someone with an account has requested their login be changed to this email address:
|
2
2
|
|
3
|
-
Old email: <%= @
|
3
|
+
Old email: <%= @account.email %>
|
4
4
|
|
5
|
-
New email: <%= @
|
5
|
+
New email: <%= @new_email %>
|
6
6
|
|
7
7
|
If you did not request this login change, please ignore this message. If you
|
8
8
|
requested this login change, please go to
|
data/rodauth-rails.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_dependency "rodauth", "~> 2.23"
|
21
21
|
spec.add_dependency "roda", "~> 3.55"
|
22
22
|
spec.add_dependency "sequel-activerecord_connection", "~> 1.1"
|
23
|
-
spec.add_dependency "rodauth-model", "~> 0.
|
23
|
+
spec.add_dependency "rodauth-model", "~> 0.2"
|
24
24
|
spec.add_dependency "tilt"
|
25
25
|
spec.add_dependency "bcrypt"
|
26
26
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rodauth-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0.
|
81
|
+
version: '0.2'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0.
|
88
|
+
version: '0.2'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: tilt
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|