quo_vadis 2.2.1 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -15
- data/README.md +22 -1
- data/app/controllers/quo_vadis/sessions_controller.rb +2 -2
- data/lib/quo_vadis/controller.rb +16 -1
- data/lib/quo_vadis/version.rb +1 -1
- data/test/integration/controller_test.rb +8 -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: e38d43ca3eb42e7fe421725da06631c57c15308a0ee0fcb395043b3c8d922bde
|
4
|
+
data.tar.gz: 2e09223593c598cdfcad8cb5947dc4065b499e9a9dee06e8eec1a7cd6124003a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69048fb28b48d94329ee3269cb706f583796893a2a8a6d7177adfb2b9b022f7fe84e4076044816d33d6e4a02b6529b3413c12b38f6dc6a3f3672095683a04610
|
7
|
+
data.tar.gz: fd2a1c93a899e07d1e9bb2a393a52eccbdb5f9256c894d03ca1eb34bc867f351dfe12149d45879ab5bc5960f9d393cdbbe7f5dc24ab43a46cc3cfa50a6454b44
|
data/CHANGELOG.md
CHANGED
@@ -4,9 +4,21 @@
|
|
4
4
|
## HEAD
|
5
5
|
|
6
6
|
|
7
|
+
## 2.2.3 (22 May 2024)
|
8
|
+
|
9
|
+
* Add login shortcut for speedier tests.
|
10
|
+
|
11
|
+
|
12
|
+
## 2.2.2 (30 April 2024)
|
13
|
+
|
14
|
+
* Do not update last activity time for ActiveStorage (#23).
|
15
|
+
* Fix login success-flash to not be reset (#37).
|
16
|
+
* Add issue numbers to changelog entries.
|
17
|
+
|
18
|
+
|
7
19
|
## 2.2.1 (1 August 2023)
|
8
20
|
|
9
|
-
* Do not clear application session data on logout.
|
21
|
+
* Do not clear application session data on logout (#34).
|
10
22
|
* Use 'email' type for email input fields.
|
11
23
|
* Document how to log out.
|
12
24
|
|
@@ -14,10 +26,10 @@
|
|
14
26
|
## 2.2.0 (17 April 2023)
|
15
27
|
|
16
28
|
* Improve the readme with internal links and more section headings.
|
17
|
-
* Rename `password_reset_token_lifetime` to `password_reset_otp_lifetime
|
18
|
-
* Use OTP instead of link for password reset.
|
19
|
-
* Rename `account_confirmation_token_lifetime` to `account_confirmation_otp_lifetime
|
20
|
-
* Use OTP instead of link for account confirmation.
|
29
|
+
* Rename `password_reset_token_lifetime` to `password_reset_otp_lifetime` (#28).
|
30
|
+
* Use OTP instead of link for password reset (#28).
|
31
|
+
* Rename `account_confirmation_token_lifetime` to `account_confirmation_otp_lifetime` (#28).
|
32
|
+
* Use OTP instead of link for account confirmation (#28).
|
21
33
|
|
22
34
|
|
23
35
|
## 2.1.11 (14 September 2022)
|
@@ -27,18 +39,18 @@
|
|
27
39
|
|
28
40
|
## 2.1.10 (14 September 2022)
|
29
41
|
|
30
|
-
* Enable configuration of mailer superclass.
|
42
|
+
* Enable configuration of mailer superclass (#30).
|
31
43
|
|
32
44
|
|
33
45
|
## 2.1.9 (13 September 2022)
|
34
46
|
|
35
|
-
* Enable code to be run after sign up.
|
47
|
+
* Enable code to be run after sign up (#29).
|
36
48
|
|
37
49
|
|
38
50
|
## 2.1.8 (18 June 2022)
|
39
51
|
|
40
|
-
* Extract convenience method for has authentication account.
|
41
|
-
* Only authenticating models react to email change.
|
52
|
+
* Extract convenience method for has authentication account (#26).
|
53
|
+
* Only authenticating models react to email change (#26).
|
42
54
|
|
43
55
|
|
44
56
|
## 2.1.7 (30 May 2022)
|
@@ -54,7 +66,7 @@
|
|
54
66
|
|
55
67
|
## 2.1.5 (27 May 2022)
|
56
68
|
|
57
|
-
* Order sessions list and display more information.
|
69
|
+
* Order sessions list and display more information (#25).
|
58
70
|
* Set status 303 See Other on destroy redirects.
|
59
71
|
* Streamline bundler instructions.
|
60
72
|
|
@@ -66,7 +78,7 @@
|
|
66
78
|
|
67
79
|
## 2.1.3 (30 September 2021)
|
68
80
|
|
69
|
-
* Pass IP and timestamp as parameters to mailer.
|
81
|
+
* Pass IP and timestamp as parameters to mailer (#24).
|
70
82
|
|
71
83
|
|
72
84
|
## 2.1.2 (30 September 2021)
|
@@ -78,8 +90,8 @@
|
|
78
90
|
|
79
91
|
* Remove unnecessary route names.
|
80
92
|
* Add user revocation.
|
81
|
-
* Ensure password is only updated via #change or #reset.
|
82
|
-
* Move views into gem's app/views/ directory.
|
93
|
+
* Ensure password is only updated via #change or #reset (#15).
|
94
|
+
* Move views into gem's app/views/ directory (#22).
|
83
95
|
|
84
96
|
|
85
97
|
## 2.1.0 (25 June 2021)
|
@@ -97,8 +109,8 @@
|
|
97
109
|
|
98
110
|
## 2.0.2 (24 May 2021)
|
99
111
|
|
100
|
-
* Account confirmation: enable updating of email address.
|
101
|
-
* Account confirmation: enable direct resending of email.
|
112
|
+
* Account confirmation: enable updating of email address (#21).
|
113
|
+
* Account confirmation: enable direct resending of email (#21).
|
102
114
|
* Log unknown identifier in metadata.
|
103
115
|
|
104
116
|
|
data/README.md
CHANGED
@@ -12,6 +12,7 @@ Simple to integrate into your application. The main task is customising the exa
|
|
12
12
|
### General features
|
13
13
|
|
14
14
|
- Works with any model, e.g. `User` or `Person`.
|
15
|
+
- Works with multiple models, e.g. `User` and `Admin`.
|
15
16
|
- Works with any identifier, e.g. `:username` or `:email`.
|
16
17
|
- Minimal footprint in your models and controllers.
|
17
18
|
- Does not touch your existing database tables.
|
@@ -31,6 +32,10 @@ Simple to integrate into your application. The main task is customising the exa
|
|
31
32
|
- Email-notifications of updates to authentication details.
|
32
33
|
- Audit trail.
|
33
34
|
|
35
|
+
### Testing
|
36
|
+
|
37
|
+
- Can shortcut logging in for speedier tests.
|
38
|
+
|
34
39
|
|
35
40
|
## Installation
|
36
41
|
|
@@ -248,7 +253,7 @@ button_to 'Log out', quo_vadis.logout_path, method: :delete
|
|
248
253
|
|
249
254
|
Note you are responsible for removing any application session data you want removed. To do so, subclass `QuoVadis::SessionsController` and override the `destroy` method:
|
250
255
|
|
251
|
-
|
256
|
+
```ruby
|
252
257
|
# app/controllers/custom_sessions_controller.rb
|
253
258
|
class CustomSessionsController < QuoVadis::SessionsController
|
254
259
|
def destroy
|
@@ -384,6 +389,22 @@ They must be in `app/views/quo_vadis/mailer/NAME.{text,html}.erb`.
|
|
384
389
|
You can revoke a user's access by calling `#revoke_authentication_credentials` on the model instance. This deletes the user's password, TOTP credential, recovery codes, and active sessions. Their authentication logs, or audit trail, are preserved.
|
385
390
|
|
386
391
|
|
392
|
+
## Shortcut logging in for functional, integration, and system tests
|
393
|
+
|
394
|
+
Instead of going through your login page to log in before every test, you can tell QuoVadis which model to authenticate as when visiting the first URL in your test.
|
395
|
+
|
396
|
+
Use a `login` param pointing to your model's global ID. Note that the model must be able to log in normally, i.e. it must have a password (and therefore a `qv_account`).
|
397
|
+
|
398
|
+
For example:
|
399
|
+
|
400
|
+
```ruby
|
401
|
+
@user = User.create(email: '...', password: '...')
|
402
|
+
visit dashboard_path(login: @user.to_global_id)
|
403
|
+
```
|
404
|
+
|
405
|
+
This only works in the test environment.
|
406
|
+
|
407
|
+
|
387
408
|
## Configuration
|
388
409
|
|
389
410
|
This is QuoVadis' [default configuration](https://github.com/airblade/quo_vadis/blob/master/lib/quo_vadis/defaults.rb):
|
@@ -39,10 +39,10 @@ module QuoVadis
|
|
39
39
|
# params[:remember] == 1 => use QuoVadis.session_lifetime
|
40
40
|
browser_session = params[:remember] == '0'
|
41
41
|
|
42
|
-
flash[:notice] = QuoVadis.translate 'flash.login.success'
|
43
|
-
|
44
42
|
login account.model, browser_session
|
45
43
|
|
44
|
+
flash[:notice] = QuoVadis.translate 'flash.login.success'
|
45
|
+
|
46
46
|
redirect_to qv.path_after_authentication
|
47
47
|
end
|
48
48
|
|
data/lib/quo_vadis/controller.rb
CHANGED
@@ -4,6 +4,15 @@ module QuoVadis
|
|
4
4
|
module Controller
|
5
5
|
|
6
6
|
def self.included(base)
|
7
|
+
if Rails.env.test?
|
8
|
+
base.before_action {
|
9
|
+
if params[:login]
|
10
|
+
model = GlobalID::Locator.locate(params.delete(:login))
|
11
|
+
login model
|
12
|
+
end
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
7
16
|
base.before_action { CurrentRequestDetails.request = request }
|
8
17
|
|
9
18
|
base.helper_method :authenticated_model, :logged_in?
|
@@ -11,7 +20,13 @@ module QuoVadis
|
|
11
20
|
# Remember the last activity time so we can timeout idle sessions.
|
12
21
|
# This has to be done after that timestamp is checked (in `#authenticated_model`)
|
13
22
|
# otherwise sessions could never look idle.
|
14
|
-
|
23
|
+
#
|
24
|
+
# Ignores ActiveStorage requests.
|
25
|
+
base.after_action { |controller|
|
26
|
+
if !defined?(::ActiveStorage) || !controller.class.module_parents.include?(::ActiveStorage)
|
27
|
+
controller.qv.touch_session_last_seen_at
|
28
|
+
end
|
29
|
+
}
|
15
30
|
end
|
16
31
|
|
17
32
|
|
data/lib/quo_vadis/version.rb
CHANGED
@@ -14,6 +14,14 @@ class ControllerTest < IntegrationTest
|
|
14
14
|
end
|
15
15
|
|
16
16
|
|
17
|
+
test 'shortcut login' do
|
18
|
+
get secret_articles_path(login: User.first.to_global_id)
|
19
|
+
|
20
|
+
assert_response :success
|
21
|
+
assert_equal secret_articles_path, path
|
22
|
+
end
|
23
|
+
|
24
|
+
|
17
25
|
test 'require_authentication when not logged in' do
|
18
26
|
get secret_articles_path
|
19
27
|
|
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.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
219
|
- !ruby/object:Gem::Version
|
220
220
|
version: '0'
|
221
221
|
requirements: []
|
222
|
-
rubygems_version: 3.
|
222
|
+
rubygems_version: 3.5.3
|
223
223
|
signing_key:
|
224
224
|
specification_version: 4
|
225
225
|
summary: Multifactor authentication for Rails 6 and 7.
|