quo_vadis 2.1.8 → 2.1.9
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 +6 -1
- data/README.md +7 -9
- data/app/controllers/quo_vadis/confirmations_controller.rb +1 -1
- data/lib/quo_vadis/controller.rb +7 -0
- data/lib/quo_vadis/version.rb +1 -1
- data/test/dummy/app/controllers/sign_ups_controller.rb +5 -0
- data/test/dummy/config/routes.rb +1 -0
- data/test/integration/account_confirmation_test.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3776f82ebb4987586131a44692de5891ec821e7e82a1de249fc3d8905ef551d8
|
4
|
+
data.tar.gz: 6914f2e05d50ffbd9451d6e50484674d7bb775d2d871922749cc4be1553e35a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5229c567fe09a76fad025b0dea0fc36192defd24e04077374816cfb99414b6a9cc3213e8410f5ee23fedb297d1b157d64345c317d646d1226655c5e60e50c1ac
|
7
|
+
data.tar.gz: 0ace7c8c5c1075eec8a54aa31ba01564a8a9ff0fec23387650a00a1721affca7c9326e083ac9f26a8afdd04bee6f6e8a748ae1c9bbf5b4e9d3b005804362afe6
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@
|
|
4
4
|
## HEAD
|
5
5
|
|
6
6
|
|
7
|
+
## 2.1.9 (13 September 2022)
|
8
|
+
|
9
|
+
* Enable code to be run after sign up.
|
10
|
+
|
11
|
+
|
7
12
|
## 2.1.8 (18 June 2022)
|
8
13
|
|
9
14
|
* Extract convenience method for has authentication account.
|
@@ -35,7 +40,7 @@
|
|
35
40
|
|
36
41
|
## 2.1.3 (30 September 2021)
|
37
42
|
|
38
|
-
* Pass IP and timestamp as
|
43
|
+
* Pass IP and timestamp as parameters to mailer.
|
39
44
|
|
40
45
|
|
41
46
|
## 2.1.2 (30 September 2021)
|
data/README.md
CHANGED
@@ -177,7 +177,7 @@ Your new user sign-up form ([example](https://github.com/airblade/quo_vadis/blob
|
|
177
177
|
|
178
178
|
In your controller, use the `#login` method to log in your new user. The optional second argument sets the length of the session (defaults to the browser session) - see the description above in the Controllers section).
|
179
179
|
|
180
|
-
After logging in the user, redirect them
|
180
|
+
After logging in the user, redirect them wherever you like. You can use `qv.path_after_signup` which resolves to the first of these routes that exists: `:after_signup`, `:after_login`, the root route.
|
181
181
|
|
182
182
|
```ruby
|
183
183
|
class UsersController < ApplicationController
|
@@ -185,7 +185,7 @@ class UsersController < ApplicationController
|
|
185
185
|
@user = User.new user_params
|
186
186
|
if @user.save
|
187
187
|
login @user
|
188
|
-
redirect_to qv.
|
188
|
+
redirect_to qv.path_after_signup
|
189
189
|
else
|
190
190
|
# ...
|
191
191
|
end
|
@@ -258,10 +258,7 @@ Next, write the page where the user can amend their email address if they made a
|
|
258
258
|
|
259
259
|
Finally, write the page where people can put in their identifier (not their email, unless the identifier is email) again to request another confirmation email ([example](https://github.com/airblade/quo_vadis/blob/master/app/views/quo_vadis/confirmations/new.html.erb)). It must be in `app/views/quo_vadis/confirmations/new.html.:format`.
|
260
260
|
|
261
|
-
After the user has confirmed their account, they will be logged in and redirected to the first of these that exists:
|
262
|
-
|
263
|
-
- a route named `:after_login`;
|
264
|
-
- your root route.
|
261
|
+
After the user has confirmed their account, they will be logged in and redirected to `qv.path_after_signup` which resolves to the first of these routes that exists: `:after_signup`, `:after_login`, the root route.
|
265
262
|
|
266
263
|
So add whichever works best for you.
|
267
264
|
|
@@ -518,12 +515,13 @@ end
|
|
518
515
|
|
519
516
|
__Routes__
|
520
517
|
|
521
|
-
You can set up your post-authentication and post-password-change routes. If you don't, you must have a root route. For example:
|
518
|
+
You can set up your post-signup, post-authentication, and post-password-change routes. If you don't, you must have a root route. For example:
|
522
519
|
|
523
520
|
```ruby
|
524
521
|
# config/routes.rb
|
525
|
-
get '/
|
526
|
-
get '/
|
522
|
+
get '/signups/confirmed', to: 'dashboards#show', as: 'after_signup'
|
523
|
+
get '/dashboard', to: 'dashboards#show', as: 'after_login'
|
524
|
+
get '/profile', to: 'profiles#show', as: 'after_password_change'
|
527
525
|
```
|
528
526
|
|
529
527
|
### I18n
|
@@ -51,7 +51,7 @@ module QuoVadis
|
|
51
51
|
session.delete :account_pending_confirmation
|
52
52
|
|
53
53
|
login account.model, true
|
54
|
-
redirect_to qv.
|
54
|
+
redirect_to qv.path_after_signup, notice: QuoVadis.translate('flash.confirmation.confirmed')
|
55
55
|
end
|
56
56
|
|
57
57
|
|
data/lib/quo_vadis/controller.rb
CHANGED
@@ -192,6 +192,13 @@ module QuoVadis
|
|
192
192
|
Log.create account: account, action: action, ip: request.remote_ip, metadata: metadata
|
193
193
|
end
|
194
194
|
|
195
|
+
def path_after_signup
|
196
|
+
return main_app.after_signup_path if main_app.respond_to?(:after_signup_path)
|
197
|
+
return main_app.after_login_path if main_app.respond_to?(:after_login_path)
|
198
|
+
return main_app.root_path if main_app.respond_to?(:root_path)
|
199
|
+
raise RuntimeError, 'Missing routes: after_signup_path, after_login_path, root_path; define at least one of them.'
|
200
|
+
end
|
201
|
+
|
195
202
|
def path_after_authentication
|
196
203
|
if (bookmark = rails_session[:qv_bookmark])
|
197
204
|
rails_session.delete :qv_bookmark
|
data/lib/quo_vadis/version.rb
CHANGED
data/test/dummy/config/routes.rb
CHANGED
@@ -33,6 +33,8 @@ class AccountConfirmationTest < IntegrationTest
|
|
33
33
|
put action_path
|
34
34
|
|
35
35
|
# verify logged in
|
36
|
+
assert_redirected_to '/sign_ups/confirmed'
|
37
|
+
follow_redirect!
|
36
38
|
assert_redirected_to '/articles/secret'
|
37
39
|
assert_equal 'Thanks for confirming your account. You are now logged in.', flash[:notice]
|
38
40
|
assert controller.logged_in?
|
@@ -101,6 +103,8 @@ class AccountConfirmationTest < IntegrationTest
|
|
101
103
|
|
102
104
|
put extract_path_from_email
|
103
105
|
|
106
|
+
assert_redirected_to '/sign_ups/confirmed'
|
107
|
+
follow_redirect!
|
104
108
|
assert_redirected_to '/articles/secret'
|
105
109
|
assert_equal 'Thanks for confirming your account. You are now logged in.', flash[:notice]
|
106
110
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quo_vadis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
224
|
- !ruby/object:Gem::Version
|
225
225
|
version: '0'
|
226
226
|
requirements: []
|
227
|
-
rubygems_version: 3.2.
|
227
|
+
rubygems_version: 3.2.33
|
228
228
|
signing_key:
|
229
229
|
specification_version: 4
|
230
230
|
summary: Multifactor authentication for Rails 6 and 7.
|