quo_vadis 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +36 -2
- data/app/views/quo_vadis/password_resets/new.html.erb +1 -1
- data/app/views/quo_vadis/sessions/new.html.erb +1 -1
- data/lib/quo_vadis/controller.rb +1 -1
- data/lib/quo_vadis/version.rb +1 -1
- data/test/README.md +6 -0
- data/test/dummy/app/controllers/articles_controller.rb +1 -0
- data/test/integration/sessions_test.rb +16 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f55b91cf69117006b0dce03a6b0d38423b587bf460c05e24984735de6a4cf8a3
|
4
|
+
data.tar.gz: 6a309a19fd35aaacbf1ec8ff5df7544ab980cecfad30664f6f0abb3778eb1d37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70bb7a3fc80f540889eb0aff8416d75759e4b2564d17d8605ad368ea8eb53e803bda66b91dd8ba0192ee061148a62fe034d164becfd4b41876100c740edfe008
|
7
|
+
data.tar.gz: cfaa08ccde542121a46a361dbdbff4a56fd6d77b4295cc1f5e0232b7c94e1514a7a422a7138add4d9e8f964a451e0038fa065f8e49a8d79a5594e180c0bb63a2
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@
|
|
4
4
|
## HEAD
|
5
5
|
|
6
6
|
|
7
|
+
## 2.2.1 (1 August 2023)
|
8
|
+
|
9
|
+
* Do not clear application session data on logout.
|
10
|
+
* Use 'email' type for email input fields.
|
11
|
+
* Document how to log out.
|
12
|
+
|
13
|
+
|
7
14
|
## 2.2.0 (17 April 2023)
|
8
15
|
|
9
16
|
* Improve the readme with internal links and more section headings.
|
data/README.md
CHANGED
@@ -171,7 +171,7 @@ Your new user sign-up form ([example](https://github.com/airblade/quo_vadis/blob
|
|
171
171
|
- a field for their identifier;
|
172
172
|
- an `:email` field if the identifier is not their email.
|
173
173
|
|
174
|
-
In your controller, use the [`#login`](#loginmodel-browser_session
|
174
|
+
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.
|
175
175
|
|
176
176
|
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.
|
177
177
|
|
@@ -238,6 +238,40 @@ After authenticating the user will be redirected to the first of these that exis
|
|
238
238
|
- your root route.
|
239
239
|
|
240
240
|
|
241
|
+
### Logout
|
242
|
+
|
243
|
+
Send a DELETE request to `quo_vadis.logout_path`. For example:
|
244
|
+
|
245
|
+
```ruby
|
246
|
+
button_to 'Log out', quo_vadis.logout_path, method: :delete
|
247
|
+
```
|
248
|
+
|
249
|
+
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
|
+
|
251
|
+
````ruby
|
252
|
+
# app/controllers/custom_sessions_controller.rb
|
253
|
+
class CustomSessionsController < QuoVadis::SessionsController
|
254
|
+
def destroy
|
255
|
+
reset_session
|
256
|
+
super
|
257
|
+
end
|
258
|
+
end
|
259
|
+
```
|
260
|
+
|
261
|
+
Add a route:
|
262
|
+
|
263
|
+
```ruby
|
264
|
+
# config/routes.rb
|
265
|
+
delete 'logout', to: 'custom_sessions#destroy'
|
266
|
+
```
|
267
|
+
|
268
|
+
And then point your log out button at your custom action:
|
269
|
+
|
270
|
+
```ruby
|
271
|
+
button_to 'Log out', main_app.logout_path, method: :delete
|
272
|
+
```
|
273
|
+
|
274
|
+
|
241
275
|
### Two-factor authentication (2FA) or Two-step verification (2SV)
|
242
276
|
|
243
277
|
If you do not want 2FA at all, set `QuoVadis.two_factor_authentication_mandatory false` in your configuration and skip the rest of this section.
|
@@ -490,6 +524,6 @@ If you don't want a specific flash message at all, give the key an empty value i
|
|
490
524
|
|
491
525
|
## Intellectual Property
|
492
526
|
|
493
|
-
Copyright
|
527
|
+
Copyright Andrew Stewart (boss@airbladesoftware.com).
|
494
528
|
|
495
529
|
Released under the MIT licence.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%= form_with url: password_reset_path, method: :post do |f| %>
|
4
4
|
<p>
|
5
5
|
<%= f.label :email %>
|
6
|
-
<%= f.text_field :email, inputmode: 'email', autocomplete: 'email' %>
|
6
|
+
<%= f.text_field :email, type: 'email', inputmode: 'email', autocomplete: 'email' %>
|
7
7
|
</p>
|
8
8
|
|
9
9
|
<p>
|
data/lib/quo_vadis/controller.rb
CHANGED
data/lib/quo_vadis/version.rb
CHANGED
data/test/README.md
ADDED
@@ -69,6 +69,22 @@ class SessionsTest < IntegrationTest
|
|
69
69
|
end
|
70
70
|
|
71
71
|
|
72
|
+
test 'non-authentication session data is not removed on logout' do
|
73
|
+
desktop = login
|
74
|
+
session_id = desktop.session.id
|
75
|
+
|
76
|
+
desktop.get secret_articles_path
|
77
|
+
assert_equal 'bar', desktop.session[:foo]
|
78
|
+
|
79
|
+
desktop.delete quo_vadis.logout_path
|
80
|
+
refute desktop.controller.logged_in?
|
81
|
+
|
82
|
+
desktop.get articles_path
|
83
|
+
assert_equal 'bar', desktop.session[:foo]
|
84
|
+
refute_equal session_id, desktop.session.id
|
85
|
+
end
|
86
|
+
|
87
|
+
|
72
88
|
private
|
73
89
|
|
74
90
|
# starts a new rails session and logs in
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -136,6 +136,7 @@ files:
|
|
136
136
|
- lib/quo_vadis/model.rb
|
137
137
|
- lib/quo_vadis/version.rb
|
138
138
|
- quo_vadis.gemspec
|
139
|
+
- test/README.md
|
139
140
|
- test/dummy/README.markdown
|
140
141
|
- test/dummy/Rakefile
|
141
142
|
- test/dummy/app/controllers/application_controller.rb
|
@@ -218,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
219
|
- !ruby/object:Gem::Version
|
219
220
|
version: '0'
|
220
221
|
requirements: []
|
221
|
-
rubygems_version: 3.
|
222
|
+
rubygems_version: 3.4.10
|
222
223
|
signing_key:
|
223
224
|
specification_version: 4
|
224
225
|
summary: Multifactor authentication for Rails 6 and 7.
|