quo_vadis 2.3.1 → 2.4.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: 917bfcbbeeda70ae1e5ccad5a77d7fdcf2a7cdff1b82b18491d50c9c69412015
4
- data.tar.gz: 6249be4270c18b0060db76000d80f638e090c724f9dd508e9334abd144296b90
3
+ metadata.gz: 49fe683373a68bb0b0dad55449c2501db61d8a270458d82816cc98d48dc3e8a7
4
+ data.tar.gz: d0105c2814b6b81330e215f644bc86df9a2fc38953e00a765e6b4c13e411cb23
5
5
  SHA512:
6
- metadata.gz: df72693e06c363389530c601d75d30f74e0897178657a0b76a1dee76e29eee2cbd009b29d1361ddc5c462292bcad518053f92efc7a8f13eafd4ec4ec0fb09907
7
- data.tar.gz: fc9541cf32483ef03f2263ba9745b971f69a2baa867221e7189d1690d32552d84f0d6ff8f6844c9e046226741a0533674039a3e2be88e4931c3940835623b1ee
6
+ metadata.gz: 881a22e6d2d2b6a54cc609f57c37ece92d4f6a74ae35dafce2cd057dd98822324d02a6fdfe68f496c85189a241ff3d282fea7adf48746ea4805cfddd18af9580
7
+ data.tar.gz: b960cd5f39665341e1caaedaa13aaa0f05f08006afe704897d5fb2c87c8ac3078a1e18f851ba45739b9778faa2f03066655b4e53ea0f3be5a55647b5fd319a4c
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@
4
4
  ## HEAD
5
5
 
6
6
 
7
+ ## 2.4.0 (13 May 2026)
8
+
9
+ * Enable post-login redirect to be specified in login URL param.
10
+ * Separate confirmation check from login check.
11
+
12
+
7
13
  ## 2.3.1 (8 May 2026)
8
14
 
9
15
  * Remove upper bound on rqrcode version.
data/README.md CHANGED
@@ -251,7 +251,8 @@ If you do not include a `remember` checkbox, the user will be logged in for `Quo
251
251
 
252
252
  After authenticating the user will be redirected to the first of these that exists:
253
253
 
254
- - the page they tried to view before they were redirected to the login page;
254
+ - the page specified in the `return` URL parameter when requesting the login page;
255
+ - the page (requiring authentication) they tried to view before they were redirected to the login page;
255
256
  - a route named `after_login`, if any;
256
257
  - your root route.
257
258
 
@@ -14,6 +14,9 @@ module QuoVadis
14
14
 
15
15
 
16
16
  def new
17
+ if (ret = params.delete(:return))
18
+ session[:qv_bookmark] = ret
19
+ end
17
20
  end
18
21
 
19
22
 
@@ -15,6 +15,10 @@ module QuoVadis
15
15
 
16
16
  base.before_action { CurrentRequestDetails.request = request }
17
17
 
18
+ base.before_action { |controller|
19
+ controller.qv.require_confirmation unless controller.class == QuoVadis::ConfirmationsController
20
+ }
21
+
18
22
  base.helper_method :authenticated_model, :logged_in?
19
23
 
20
24
  # Remember the last activity time so we can timeout idle sessions.
@@ -31,14 +35,7 @@ module QuoVadis
31
35
 
32
36
 
33
37
  def require_password_authentication
34
- if logged_in?
35
- if QuoVadis.accounts_require_confirmation && !authenticated_model.qv_account.confirmed?
36
- qv.request_confirmation authenticated_model
37
- session[:qv_bookmark] = request.original_fullpath
38
- redirect_to quo_vadis.confirm_path
39
- end
40
- return
41
- end
38
+ return if logged_in?
42
39
  session[:qv_bookmark] = request.original_fullpath
43
40
  redirect_to quo_vadis.login_path, notice: QuoVadis.translate('flash.require_authentication')
44
41
  end
@@ -156,6 +153,16 @@ module QuoVadis
156
153
  old_session.each { |k,v| rails_session[k] = v }
157
154
  end
158
155
 
156
+ def require_confirmation
157
+ return if ! QuoVadis.accounts_require_confirmation
158
+ return if ! controller.logged_in?
159
+ return if controller.authenticated_model.qv_account.confirmed?
160
+
161
+ request_confirmation controller.authenticated_model
162
+ rails_session[:qv_bookmark] = controller.request.original_fullpath
163
+ controller.redirect_to controller.quo_vadis.confirm_path
164
+ end
165
+
159
166
  def request_confirmation(model)
160
167
  rails_session[:account_pending_confirmation] = model.qv_account.id
161
168
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module QuoVadis
4
- VERSION = '2.3.1'
4
+ VERSION = '2.4.0'
5
5
  end
@@ -42,6 +42,18 @@ class PasswordLoginTest < IntegrationTest
42
42
  end
43
43
 
44
44
 
45
+ test 'successful login redirect page can be overridden' do
46
+ get quo_vadis.login_path(return: "/articles")
47
+ refute_nil session[:qv_bookmark]
48
+
49
+ User.create! name: 'bob', email: 'bob@example.com', password: '123456789abc'
50
+ post quo_vadis.login_path(email: 'bob@example.com', password: '123456789abc')
51
+
52
+ assert_redirected_to articles_path
53
+ assert_nil session[:qv_bookmark]
54
+ end
55
+
56
+
45
57
  test 'failed login' do
46
58
  User.create! name: 'bob', email: 'bob@example.com', password: '123456789abc'
47
59
  post quo_vadis.login_path(email: 'bob@example.com', password: 'wrong')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quo_vadis
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Stewart