quo_vadis 2.2.6 → 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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +6 -12
- data/app/controllers/quo_vadis/confirmations_controller.rb +4 -4
- data/app/mailers/quo_vadis/mailer.rb +2 -2
- data/config/locales/quo_vadis.en.yml +2 -2
- data/lib/quo_vadis/controller.rb +1 -7
- data/lib/quo_vadis/version.rb +1 -1
- data/test/dummy/app/controllers/sign_ups_controller.rb +0 -5
- data/test/dummy/config/routes.rb +0 -1
- data/test/integration/account_confirmation_test.rb +1 -3
- data/test/mailers/mailer_test.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 99defadc14bc4d695dccfad2f131ea6817ae931b1af1a65cc2418a5c3dbe1444
|
|
4
|
+
data.tar.gz: 2585f246fe58c479cee88852a155aa66d1ae4ff3f18f9c353216529a096a1f75
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 04a76b0961a32febb4860656ba4a45faaeec652c3174450393583c3667af51950b55f8c9995b123ee135396c442da607512541d8dd01c6cedbfb279f736085aa
|
|
7
|
+
data.tar.gz: e38c400e9a0151691616e522218954d76347fec42cfa479d240166d8bdae95c75cd00d7e56cb4a92c8ec7da7a53b45b6847b1b942df3043f7ddc49bed1ecef56
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
## HEAD
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## 2.3.0 (18 November 2025)
|
|
8
|
+
|
|
9
|
+
* Upon confirmation redirect to original path.
|
|
10
|
+
* Remove concept of after_signup route.
|
|
11
|
+
* Enable OTP to be given in i18n mailer subject.
|
|
12
|
+
|
|
13
|
+
|
|
7
14
|
## 2.2.6 (17 November 2025)
|
|
8
15
|
|
|
9
16
|
* Make permitting of password updates explicit.
|
data/README.md
CHANGED
|
@@ -197,15 +197,15 @@ Your new user sign-up form ([example](https://github.com/airblade/quo_vadis/blob
|
|
|
197
197
|
|
|
198
198
|
In your controller, use the [`#login`](#loginmodel-browser_session--true-metadata-) method to log in your new user. The optional second argument specifies for how long the user should be logged in, and any metadata you supply is logged in the audit log.
|
|
199
199
|
|
|
200
|
-
After logging in the user, redirect them wherever you like
|
|
200
|
+
After logging in the user, redirect them wherever you like as normal.
|
|
201
201
|
|
|
202
202
|
```ruby
|
|
203
203
|
class UsersController < ApplicationController
|
|
204
204
|
def create
|
|
205
205
|
@user = User.new user_params
|
|
206
206
|
if @user.save
|
|
207
|
-
login @user
|
|
208
|
-
redirect_to
|
|
207
|
+
login @user # <-- add this
|
|
208
|
+
redirect_to dashboard_path
|
|
209
209
|
else
|
|
210
210
|
# ...
|
|
211
211
|
end
|
|
@@ -219,21 +219,15 @@ class UsersController < ApplicationController
|
|
|
219
219
|
end
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
-
```ruby
|
|
223
|
-
# config/routes.rb
|
|
224
|
-
get '/dashboard', as: 'after_login'
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
|
|
228
222
|
### Sign up with account confirmation
|
|
229
223
|
|
|
230
224
|
Follow the steps above for sign-up.
|
|
231
225
|
|
|
232
|
-
After you have logged in the user and redirected them
|
|
226
|
+
After you have logged in the user and redirected them, QuoVadis detects that they need to confirm their account. QuoVadis emails them a 6-digit confirmation code and redirects them to the confirmation page where they can enter that code.
|
|
233
227
|
|
|
234
228
|
The confirmation code is valid for `QuoVadis.account_confirmation_otp_lifetime`.
|
|
235
229
|
|
|
236
|
-
Once the user has confirmed their account, they will be redirected to
|
|
230
|
+
Once the user has confirmed their account, they will be redirected to the page they requested before they were redirected to the confirmation page.
|
|
237
231
|
|
|
238
232
|
You need to write the email view ([example](https://github.com/airblade/quo_vadis/blob/master/app/views/quo_vadis/mailer/account_confirmation.text.erb)). It must be in `app/views/quo_vadis/mailer/account_confirmation.{text,html}.erb` and output the `@otp` variable. See the [Configuration](#configuration) section for how to set QuoVadis's emails' from addresses, headers, etc.
|
|
239
233
|
|
|
@@ -555,7 +549,7 @@ get '/profile', to: 'profiles#show', as: 'after_password_change'
|
|
|
555
549
|
|
|
556
550
|
### I18n
|
|
557
551
|
|
|
558
|
-
All QuoVadis' flash messages
|
|
552
|
+
All QuoVadis' text (flash messages, mail subjects, and log messages) is set via [i18n](https://github.com/airblade/quo_vadis/blob/master/config/locales/quo_vadis.en.yml).
|
|
559
553
|
|
|
560
554
|
You can override any of the messages with your own locale file at `config/locales/quo_vadis.en.yml`.
|
|
561
555
|
|
|
@@ -7,7 +7,7 @@ module QuoVadis
|
|
|
7
7
|
@account = find_pending_account_from_session
|
|
8
8
|
|
|
9
9
|
unless @account
|
|
10
|
-
redirect_to qv.
|
|
10
|
+
redirect_to qv.path_after_authentication, alert: QuoVadis.translate('flash.confirmation.unknown')
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -16,7 +16,7 @@ module QuoVadis
|
|
|
16
16
|
@account = find_pending_account_from_session
|
|
17
17
|
|
|
18
18
|
unless @account
|
|
19
|
-
redirect_to qv.
|
|
19
|
+
redirect_to qv.path_after_authentication, alert: QuoVadis.translate('flash.confirmation.unknown')
|
|
20
20
|
return
|
|
21
21
|
end
|
|
22
22
|
|
|
@@ -39,7 +39,7 @@ module QuoVadis
|
|
|
39
39
|
session.delete :account_pending_confirmation
|
|
40
40
|
session.delete :account_confirmation_expires_at
|
|
41
41
|
|
|
42
|
-
redirect_to qv.
|
|
42
|
+
redirect_to qv.path_after_authentication, notice: QuoVadis.translate('flash.confirmation.confirmed')
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
|
|
@@ -47,7 +47,7 @@ module QuoVadis
|
|
|
47
47
|
@account = find_pending_account_from_session
|
|
48
48
|
|
|
49
49
|
unless @account
|
|
50
|
-
redirect_to qv.
|
|
50
|
+
redirect_to qv.path_after_authentication, alert: QuoVadis.translate('flash.confirmation.unknown')
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
qv.request_confirmation @account.model
|
|
@@ -5,12 +5,12 @@ module QuoVadis
|
|
|
5
5
|
|
|
6
6
|
def reset_password
|
|
7
7
|
@otp = params[:otp]
|
|
8
|
-
_mail params[:email], QuoVadis.translate('mailer.password_reset.subject')
|
|
8
|
+
_mail params[:email], QuoVadis.translate('mailer.password_reset.subject', otp: params[:otp])
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def account_confirmation
|
|
12
12
|
@otp = params[:otp]
|
|
13
|
-
_mail params[:email], QuoVadis.translate('mailer.confirmation.subject')
|
|
13
|
+
_mail params[:email], QuoVadis.translate('mailer.confirmation.subject', otp: params[:otp])
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def email_change_notification
|
|
@@ -35,9 +35,9 @@ en:
|
|
|
35
35
|
invalidated: You have invalidated your 2FA credentials and recovery codes.
|
|
36
36
|
mailer:
|
|
37
37
|
password_reset:
|
|
38
|
-
subject:
|
|
38
|
+
subject: Your password reset code is %{otp}
|
|
39
39
|
confirmation:
|
|
40
|
-
subject:
|
|
40
|
+
subject: Your account confirmation code is %{otp}
|
|
41
41
|
notification:
|
|
42
42
|
email_change: Your email address has been changed
|
|
43
43
|
identifier_change: Your %{identifier} has been changed
|
data/lib/quo_vadis/controller.rb
CHANGED
|
@@ -34,6 +34,7 @@ module QuoVadis
|
|
|
34
34
|
if logged_in?
|
|
35
35
|
if QuoVadis.accounts_require_confirmation && !authenticated_model.qv_account.confirmed?
|
|
36
36
|
qv.request_confirmation authenticated_model
|
|
37
|
+
session[:qv_bookmark] = request.original_fullpath
|
|
37
38
|
redirect_to quo_vadis.confirm_path
|
|
38
39
|
end
|
|
39
40
|
return
|
|
@@ -217,13 +218,6 @@ module QuoVadis
|
|
|
217
218
|
Log.create account: account, action: action, ip: request.remote_ip, metadata: metadata
|
|
218
219
|
end
|
|
219
220
|
|
|
220
|
-
def path_after_signup
|
|
221
|
-
return main_app.after_signup_path if main_app.respond_to?(:after_signup_path)
|
|
222
|
-
return main_app.after_login_path if main_app.respond_to?(:after_login_path)
|
|
223
|
-
return main_app.root_path if main_app.respond_to?(:root_path)
|
|
224
|
-
raise RuntimeError, 'Missing routes: after_signup_path, after_login_path, root_path; define at least one of them.'
|
|
225
|
-
end
|
|
226
|
-
|
|
227
221
|
def path_after_authentication
|
|
228
222
|
if (bookmark = rails_session[:qv_bookmark])
|
|
229
223
|
rails_session.delete :qv_bookmark
|
data/lib/quo_vadis/version.rb
CHANGED
data/test/dummy/config/routes.rb
CHANGED
|
@@ -30,8 +30,6 @@ class AccountConfirmationTest < IntegrationTest
|
|
|
30
30
|
post quo_vadis.confirm_path(otp: code)
|
|
31
31
|
|
|
32
32
|
# verify logged in
|
|
33
|
-
assert_redirected_to '/sign_ups/confirmed'
|
|
34
|
-
follow_redirect!
|
|
35
33
|
assert_redirected_to '/articles/secret'
|
|
36
34
|
assert_equal 'Thanks for confirming your account.', flash[:notice]
|
|
37
35
|
assert QuoVadis::Account.last.confirmed?
|
|
@@ -64,7 +62,7 @@ class AccountConfirmationTest < IntegrationTest
|
|
|
64
62
|
|
|
65
63
|
post quo_vadis.confirm_path(otp: code)
|
|
66
64
|
assert_equal 'You have already confirmed your account.', flash[:alert]
|
|
67
|
-
assert_redirected_to '/
|
|
65
|
+
assert_redirected_to '/articles/secret'
|
|
68
66
|
end
|
|
69
67
|
|
|
70
68
|
|
data/test/mailers/mailer_test.rb
CHANGED
|
@@ -21,7 +21,7 @@ class MailerTest < ActionMailer::TestCase
|
|
|
21
21
|
|
|
22
22
|
assert_equal ['foo@example.com'], email.to
|
|
23
23
|
assert_equal ['bar@example.com'], email.from
|
|
24
|
-
assert_equal '
|
|
24
|
+
assert_equal 'Your password reset code is 314159', email.subject
|
|
25
25
|
assert_equal read_fixture('reset_password.text').join, email.body.to_s
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -38,7 +38,7 @@ class MailerTest < ActionMailer::TestCase
|
|
|
38
38
|
|
|
39
39
|
assert_equal ['foo@example.com'], email.to
|
|
40
40
|
assert_equal ['bar@example.com'], email.from
|
|
41
|
-
assert_equal '
|
|
41
|
+
assert_equal 'Your account confirmation code is 271828', email.subject
|
|
42
42
|
assert_equal read_fixture('account_confirmation.text').join, email.body.to_s
|
|
43
43
|
end
|
|
44
44
|
|