rodauth-select-account 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90895ef37a108c15a07ad95b7e7e834a792e495dfc6a5b00e95f5cba0e8f5641
4
- data.tar.gz: e9e436f0e30f7a96e296c9ddb6059cfcf23ad4b1ea0a764d9345669cf82633a7
3
+ metadata.gz: 54558f068bac6c32c070a056d1b4ffbc6b86878fbbedd2b5b4561b97233a169e
4
+ data.tar.gz: ae04cf2fedd5df579a98969ad6ca2e8154e78a2451ebabf244fc0015a34c3ae9
5
5
  SHA512:
6
- metadata.gz: 6f27e0dec0e492dfb2de6b50edb469d10a913702a86e823428b5db7e37e9bc01884cc7f8c9f36d81158fec1514f8953b74a07ea646c40b727c80f5cdd3b839da
7
- data.tar.gz: 6e79144222edfd09428c7f679036a4306d9ee51a03cd9e40ce2892908066ab60f7f6c59cb06fd9625391bbfd189a68ed0d828bda4b9282f04ee12878be721ea1
6
+ metadata.gz: 82210732ab64e6ce8c418767daebd2e69833f224c068c594725c12f171eed0871f955079ebcfa6c93a35f7eeee7e49e779d293ad4fa6b45f66b0d6acf90bdd90
7
+ data.tar.gz: 14d2ec75e8f69e4e160e016d6b50a95f4697e05739e4edf9f74bcd5406dc3c3f274592afc6c036390a3596415116bd15490b358cd92a87842ea0ce98b58ffed7
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.1.3
6
+
7
+ * allow setting `require_selected_account_cookie_interval` and `accounts_cookie_interval` to `nil` in order to set the managed cookies as "Session Cookies" (i.e. getting wiped out on browser close).
8
+
5
9
  ## 0.1.2
6
10
 
7
11
  point release to update project links in rubygems.
@@ -0,0 +1,47 @@
1
+ = Documentation for Select Account
2
+
3
+ The +select_account+ feature allows for maintaining and switching across multiple accounts in the same session.
4
+
5
+ == Auth Value Methods
6
+
7
+ selected_account_key :: session key where the selected account state is stored.
8
+ accounts_key :: session key where the logged-in accounts state is stored.
9
+ add_account_redirect_session_key :: session key where the url to redirect to after adding an account is stored.
10
+ select_account_redirect_session_key :: session key where the url to redirect to after selecting an account is stored.
11
+ require_selected_account_cookie_key :: cookie key storing whether a selected account is required.
12
+ require_selected_account_cookie_interval :: duration for the require selected account cookie (5 minutes by default); can be set to <tt>nil</tt> in order not to set cookie "Expires".
13
+ accounts_cookie_key :: cookie key where the selected accounts are stored.
14
+ accounts_cookie_options :: cookie options for the selected accounts cookie
15
+ accounts_cookie_interval :: duration for the selected accounts cookie (14 days by default); can be set to <tt>nil</tt> in order not to set cookie "Expires".
16
+ no_account_error_status :: http status code for the response when the account to switch to does not exist anymore.
17
+ select_account_required_error_status :: http status code for the response when a selected account is required.
18
+ add_account_required_error_status :: http status code for the response when addig an account is required.
19
+ no_account_message :: error description when no account was found, <tt>"could not select account"</tt> by default.
20
+
21
+
22
+ add_account_button :: Label of add account button.
23
+ add_account_error_flash :: The flash error message to display when there was an error adding an account.
24
+ add_account_notice_flash :: The flash success message to display after adding an account.
25
+ require_add_account_error_flash :: he flash error message to display when adding an account is required.
26
+ add_account_page_title :: Title for the Add Account form.
27
+ add_account_redirect :: URL to redirect to after adding an account.
28
+ add_account_route :: the route for adding an account, +add-account+ by default.
29
+
30
+ select_account_error_flash :: The flash error message to display when there was an error selecting an account.
31
+ select_account_notice_flash :: The flash success message to display after selecting an account.
32
+ require_select_account_error_flash :: he flash error message to display when selecting an account is required.
33
+ select_account_page_title :: Title for the Select Account form.
34
+ select_account_redirect :: URL to redirect to after selecting an account.
35
+ select_account_route :: the route for selecting an account, +select-account+ by default.
36
+
37
+
38
+ == Auth Methods
39
+
40
+ add_account_view :: The HTML template of the Add Account form.
41
+ before_add_account_route :: Run arbitrary code before the add account route.
42
+ before_add_account :: Run arbitrary code before adding an account.
43
+ after_add_account :: Run arbitrary code after adding an account.
44
+ select_account_view :: The HTML template of the Select Account form.
45
+ before_select_account_route :: Run arbitrary code before the add account route.
46
+ before_select_account :: Run arbitrary code before selecting an account.
47
+ after_select_account :: Run arbitrary code after selecting an account.
@@ -62,7 +62,7 @@ module Rodauth
62
62
  end
63
63
 
64
64
  opts[:value] = true
65
- opts[:expires] = Time.now + require_selected_account_cookie_interval
65
+ opts[:expires] = Time.now + require_selected_account_cookie_interval if require_selected_account_cookie_interval
66
66
  opts[:httponly] = true unless opts.key?(:httponly)
67
67
  opts[:secure] = true unless opts.key?(:secure) || !request.ssl?
68
68
 
@@ -177,7 +177,7 @@ module Rodauth
177
177
 
178
178
  opts = Hash[accounts_cookie_options]
179
179
  opts[:value] = accounts_cookie.join(",")
180
- opts[:expires] = Time.now + accounts_cookie_interval
180
+ opts[:expires] = Time.now + accounts_cookie_interval if accounts_cookie_interval
181
181
  opts[:path] = "/" unless opts.key?(:path)
182
182
  opts[:httponly] = true unless opts.key?(:httponly)
183
183
  opts[:secure] = true unless opts.key?(:secure) || !request.ssl?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rodauth
4
4
  module SelectAccount
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth-select-account
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-10 00:00:00.000000000 Z
11
+ date: 2025-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rodauth
@@ -33,10 +33,12 @@ extra_rdoc_files:
33
33
  - LICENSE.txt
34
34
  - README.md
35
35
  - CHANGELOG.md
36
+ - doc/select_account.rdoc
36
37
  files:
37
38
  - CHANGELOG.md
38
39
  - LICENSE.txt
39
40
  - README.md
41
+ - doc/select_account.rdoc
40
42
  - lib/rodauth/features/select_account.rb
41
43
  - lib/rodauth/select-account.rb
42
44
  - lib/rodauth/select-account/version.rb
@@ -64,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
66
  - !ruby/object:Gem::Version
65
67
  version: '0'
66
68
  requirements: []
67
- rubygems_version: 3.2.32
69
+ rubygems_version: 3.5.3
68
70
  signing_key:
69
71
  specification_version: 4
70
72
  summary: Multiple authenticated accounts per session in rodauth.