govuk_personalisation 0.10.0 → 0.11.2

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: d966869deca66c3fbea1730d7b2478ca77bc019d499b824269a9456eeffa82d9
4
- data.tar.gz: fc4735bde8c3077c1e8e2795e4deb496b2c7816bfe6006057b0c8e59ceb27196
3
+ metadata.gz: 3027b7bc4c484759eed32262b7988b2a6f8953b57634d35174002881dedbd806
4
+ data.tar.gz: f504185b2dee2d3c4cd0c9627a54872c4cb10744ea19bb96a9ceea22bed1cd75
5
5
  SHA512:
6
- metadata.gz: 826c826f13b08be03d467655bab27bab323ec6b8823bdddc25b52f0d20906344ee4ece5c95a31bf7726e2aabdea0511b46934b5a37137d7e8788d496b570395f
7
- data.tar.gz: a74b510d5f549e3d0cc9df6b533763d5ac9a3c9211e424f49372b705acb9bb64229f35794f0aadaeee5492d8108040a5780acdc9a8e4d5c7bb4cf54a88b4b979
6
+ metadata.gz: 83785705cddaee76e6804d2d4f64cfb2cedc1ac5dbeab91e5f07e982e4fd1a1ffbcbc0d8f56e26afb9551298be122aed9cc36a42b58690b405440ed86f4c0dd2
7
+ data.tar.gz: 39f5a7677091f18583ebc374541af421a61f70968cedd4954ba7ac69444d1758a394430c80308ab38976a9633de2e71406b9221e446e3950853b896b267ec88f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # 0.11.2
2
+
3
+ - Add support for Rails 7 ([#33](https://github.com/alphagov/govuk_personalisation/pull/33))
4
+
5
+ # 0.11.1
6
+
7
+ - Change sign in path to `/account` ([#28](https://github.com/alphagov/govuk_personalisation/pull/28))
8
+
9
+ # 0.11.0
10
+
11
+ - Remove references to the account manager from the URLs module ([#26](https://github.com/alphagov/govuk_personalisation/pull/26))
12
+
13
+ # 0.10.1
14
+
15
+ - Make session-change events uncacheable ([#24](https://github.com/alphagov/govuk_personalisation/pull/24))
16
+
1
17
  # 0.10.0
2
18
  - Add `url_with_analytics` helper to allow apps to access the URL used for `redirect_with_analytics` ([#22](https://github.com/alphagov/govuk_personalisation/pull/22))
3
19
 
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = %w[lib]
27
27
 
28
28
  spec.add_dependency "plek", ">= 1.9.0"
29
- spec.add_dependency "rails", "~> 6"
29
+ spec.add_dependency "rails", ">= 6", "< 8"
30
30
 
31
31
  spec.add_development_dependency "bundler"
32
32
  spec.add_development_dependency "climate_control"
@@ -83,6 +83,8 @@ module GovukPersonalisation
83
83
  session_with_flash = GovukPersonalisation::Flash.encode_session(@account_session_header, @new_account_flash.keys)
84
84
 
85
85
  response.headers[ACCOUNT_SESSION_HEADER_NAME] = session_with_flash
86
+ response.headers["Cache-Control"] = "no-store"
87
+
86
88
  if Rails.env.development?
87
89
  cookies[ACCOUNT_SESSION_DEV_COOKIE_NAME] = {
88
90
  value: session_with_flash,
@@ -95,7 +97,10 @@ module GovukPersonalisation
95
97
  # header.
96
98
  def logout!
97
99
  response.headers[ACCOUNT_END_SESSION_HEADER_NAME] = "1"
100
+ response.headers["Cache-Control"] = "no-store"
101
+
98
102
  @account_session_header = nil
103
+
99
104
  if Rails.env.development?
100
105
  cookies[ACCOUNT_SESSION_DEV_COOKIE_NAME] = {
101
106
  value: "",
@@ -130,8 +135,8 @@ module GovukPersonalisation
130
135
  # and cookie consent
131
136
  #
132
137
  # @param url [String] The URL to redirect to
133
- def redirect_with_analytics(url)
134
- redirect_to url_with_analytics(url)
138
+ def redirect_with_analytics(url, allow_other_host: true)
139
+ redirect_to(url_with_analytics(url), allow_other_host: allow_other_host)
135
140
  end
136
141
 
137
142
  # Build a URL adding parameters necessary for cross-domain analytics
@@ -5,7 +5,7 @@ module GovukPersonalisation::Urls
5
5
  #
6
6
  # @return [String] the URL
7
7
  def self.sign_in
8
- find_govuk_url(var: "SIGN_IN", application: "frontend", path: "/sign-in/redirect")
8
+ find_govuk_url(var: "SIGN_IN", application: "frontend", path: "/account")
9
9
  end
10
10
 
11
11
  # Find the GOV.UK URL for the "sign out" page
@@ -26,21 +26,21 @@ module GovukPersonalisation::Urls
26
26
  #
27
27
  # @return [String] the URL
28
28
  def self.manage
29
- find_external_url(var: "MANAGE", application: "account-manager", path: "/account/manage")
29
+ find_external_url(var: "MANAGE", url: "https://#{digital_identity_domain}?link=manage-account")
30
30
  end
31
31
 
32
32
  # Find the external URL for the "security" page
33
33
  #
34
34
  # @return [String] the URL
35
35
  def self.security
36
- find_external_url(var: "SECURITY", application: "account-manager", path: "/account/security")
36
+ find_external_url(var: "SECURITY", url: "https://#{digital_identity_domain}?link=security-privacy")
37
37
  end
38
38
 
39
39
  # Find the external URL for the "feedback" page
40
40
  #
41
41
  # @return [String] the URL
42
42
  def self.feedback
43
- find_external_url(var: "FEEDBACK", application: "account-manager", path: "/feedback")
43
+ find_external_url(var: "FEEDBACK", url: "https://signin.account.gov.uk/support")
44
44
  end
45
45
 
46
46
  # Finds a URL on www.gov.uk. This method is used so we can have
@@ -76,12 +76,23 @@ module GovukPersonalisation::Urls
76
76
  #
77
77
  # Otherwise, an application URL generated by Plek will be returned.
78
78
  #
79
- # @param var [String] the name of the variable to look up
80
- # @param application [String] the name of the frontend application, passed to Plek (if the env var is set, this is ignored)
81
- # @param path [String] the path to use (if the env var is set this is ignored)
79
+ # @param var [String] the name of the variable to look up
80
+ # @param url [String] the url to default to if there is no environment variable set
82
81
  #
83
82
  # @return [String] the URL
84
- def self.find_external_url(var:, application:, path:)
85
- ENV.fetch("GOVUK_PERSONALISATION_#{var}_URI", "#{Plek.find(application)}#{path}")
83
+ def self.find_external_url(var:, url:)
84
+ ENV.fetch("GOVUK_PERSONALISATION_#{var}_URI", url)
85
+ end
86
+
87
+ # Gets the Digital Identity domain for the current environment
88
+ #
89
+ # @return [String] the domain
90
+ def self.digital_identity_domain
91
+ environment = ENV["DIGITAL_IDENTITY_ENVIRONMENT"]
92
+ if environment
93
+ "#{environment}.account.gov.uk"
94
+ else
95
+ "account.gov.uk"
96
+ end
86
97
  end
87
98
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GovukPersonalisation
4
- VERSION = "0.10.0"
4
+ VERSION = "0.11.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_personalisation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-26 00:00:00.000000000 Z
11
+ date: 2022-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '6'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '8'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '6'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '8'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: bundler
43
49
  requirement: !ruby/object:Gem::Requirement