govuk_personalisation 0.9.0 → 0.11.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 +15 -0
- data/lib/govuk_personalisation/controller_concern.rb +14 -1
- data/lib/govuk_personalisation/urls.rb +20 -9
- data/lib/govuk_personalisation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ba20f9a3fd76c87998ab8d9739285c31273622fdf9f7692deef3d817aa351aa
|
4
|
+
data.tar.gz: a107bccb957e141838450837cb95c6677889c37c3418eaea5907408beb596afa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8146a1c9c9e6db27a9066a79a55956888c814e2cad26c474bc76a33f66b8d8b395eb87eca8e29116526e928bbe672e89784b033c62e9d09858f4db8a231cdb0a
|
7
|
+
data.tar.gz: e93d8f2a38ff9c552691f123ad90525f1a737e792d9caa3692c0b2eb92a95712791868bae87b322bb463a27d7c6cf844a37a47fffa5a284a437b8d61df6f5634
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# 0.11.1
|
2
|
+
|
3
|
+
- Change sign in path to `/account` ([#28](https://github.com/alphagov/govuk_personalisation/pull/28))
|
4
|
+
|
5
|
+
# 0.11.0
|
6
|
+
|
7
|
+
- Remove references to the account manager from the URLs module ([#26](https://github.com/alphagov/govuk_personalisation/pull/26))
|
8
|
+
|
9
|
+
# 0.10.1
|
10
|
+
|
11
|
+
- Make session-change events uncacheable ([#24](https://github.com/alphagov/govuk_personalisation/pull/24))
|
12
|
+
|
13
|
+
# 0.10.0
|
14
|
+
- 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))
|
15
|
+
|
1
16
|
# 0.9.0
|
2
17
|
- Add `redirect_with_analytics` helper, attaches _ga and cookie_consent values from existing params to redirects. ([#19](https://github.com/alphagov/govuk_personalisation/pull/19))
|
3
18
|
- Add `GovukPersonalisation::Redirect` and `.build_url` helper to construct valid URLs with additional parameters. ([#19](https://github.com/alphagov/govuk_personalisation/pull/19))
|
@@ -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: "",
|
@@ -131,7 +136,15 @@ module GovukPersonalisation
|
|
131
136
|
#
|
132
137
|
# @param url [String] The URL to redirect to
|
133
138
|
def redirect_with_analytics(url)
|
134
|
-
redirect_to
|
139
|
+
redirect_to url_with_analytics(url)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Build a URL adding parameters necessary for cross-domain analytics
|
143
|
+
# and cookie consent
|
144
|
+
#
|
145
|
+
# @param url [String] The URL
|
146
|
+
def url_with_analytics(url)
|
147
|
+
GovukPersonalisation::Redirect.build_url(url, params.permit(:_ga, :cookie_consent).to_h)
|
135
148
|
end
|
136
149
|
end
|
137
150
|
end
|
@@ -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: "/
|
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",
|
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",
|
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",
|
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
|
80
|
-
# @param
|
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:,
|
85
|
-
ENV.fetch("GOVUK_PERSONALISATION_#{var}_URI",
|
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
|
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.
|
4
|
+
version: 0.11.1
|
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:
|
11
|
+
date: 2022-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|