Commit Graph

15 Commits

Author SHA1 Message Date
Tom Byers
6d620dd283 Fix timestamp used for clearing old cookies
The code in the test that added the 'old' cookies
uses Greenwich Mean Time (GMT) format:

https://github.com/alphagov/notifications-admin/blob/master/tests/javascripts/support/helpers/cookies.js#L19

The code that cleared any 'old' cookies doesn't
specify a time format so uses that set on the host
OS:

https://github.com/alphagov/notifications-admin/blob/master/app/assets/javascripts/cookieMessage.js#L12
https://github.com/alphagov/notifications-admin/blob/master/app/assets/javascripts/cookieMessage.js#L19

Cookies are deleted by setting the data to one
that has expired. Because of the hour difference
the date set to make the cookies expire didn't
work.

This fixes that by making the clearing up code use
GMT.
2020-04-08 08:51:53 +01:00
Tom Byers
6c2af9e696 Set cookie on document host by removing domain
Cookies using the hostname as a domain will be set
with a prefix of `.` by browsers, it seems to
ensure all subdomains are included in the scope.

When deleting the `seen_cookie_message` cookie we
want to set its domain without a `.` prefix, to
match the domain set by the original code.

Leaving the `domain` attribute out from the cookie
string will ensure the `.` prefix is not set.
2020-01-23 13:17:40 +00:00
Tom Byers
174c10c7ff Clear old cookies to be based on consent
We have been clearing all the Google Analytics
cookies on each page request.

It is now possible for a user to consent to having
Google Analytics cookies so this should have been
checking for that before deleting them.

This makes that change, with tests for those
scenarios.
2020-01-22 12:14:23 +00:00
Tom Byers
1d9c5e5da9 Default the cookie banner to be hidden
It should only be shown if JS is available and the
cookieMessage JS finds consent has not been set.
2020-01-20 10:04:58 +00:00
Tom Byers
1d864943c5 Move code for deleting old cookies into banner JS
Removes the following cookies:
- seen_cookie_message (flags if banner was already
  shown)
- _gid (Google Analytics cookie)
- _ga (Google Analytics cookie)

These were set by default before so potentially
still around for some users.

The code for this now exists as a static method on
the cookieMessage module and is called when the JS
loads for the first time.
2020-01-20 10:03:19 +00:00
Tom Byers
fa7104d6c8 Add new cookie banner code.
Copies HTML and Sass from GOV.UK Pubishing
components cookie-banner with changes to content
and functionality to better suit Notify.

Changes are:
- adds a 'reject' button which the GOV.UK
  code doesn't have
- adds Sass from the GOV.UK Frontend button
  component which the GOV.UK version used so
  is included here
- removed click tracking from cookie banner
2020-01-20 10:03:18 +00:00
Leo Hemsted
66db735e09 Revert "Merge pull request #3238 from alphagov/cookies-update"
This reverts commit eec4bec761, reversing
changes made to 64480e2fff.
2020-01-15 14:40:48 +00:00
Tom Byers
c18cb1e984 Default the cookie banner to be hidden
It should only be shown if JS is available and the
cookieMessage JS finds consent has not been set.
2020-01-14 12:11:40 +00:00
Tom Byers
f46dba8948 Move code for deleting old cookies into banner JS
Removes the following cookies:
- seen_cookie_message (flags if banner was already
  shown)
- _gid (Google Analytics cookie)
- _ga (Google Analytics cookie)

These were set by default before so potentially
still around for some users.

The code for this now exists as a static method on
the cookieMessage module and is called when the JS
loads for the first time.
2020-01-03 17:28:33 +00:00
Tom Byers
3a6537f49f Add new cookie banner code.
Copies HTML and Sass from GOV.UK Pubishing
components cookie-banner with changes to content
and functionality to better suit Notify.

Changes are:
- adds a 'reject' button which the GOV.UK
  code doesn't have
- adds Sass from the GOV.UK Frontend button
  component which the GOV.UK version used so
  is included here
- removed click tracking from cookie banner
2020-01-03 17:28:33 +00:00
Tom Byers
ab4ec7197a Put cookies message back in
The cookie_message block was part of GOV.UK
template but is not included in the GOV.UK
Frontend template.

This adds it back in along with JS to set the
cookies from GOV.UK template and styles, taken
from the Design System's website (which I assume
has the right colour contrast).
2019-11-27 14:15:32 +00:00
Tom Byers
e09d510ab8 Revert "Replace govuk template with govuk frontend components - rewrite" 2019-11-26 12:14:09 +00:00
Tom Byers
b9c035fdab Put cookies message back in
The cookie_message block was part of GOV.UK
template but is not included in the GOV.UK
Frontend template.

This adds it back in along with JS to set the
cookies from GOV.UK template and styles, taken
from the Design System's website (which I assume
has the right colour contrast).
2019-11-25 11:43:30 +00:00
Tom Byers
e02f94f238 Revert "Replace govuk template with govuk frontend components" 2019-11-25 10:37:35 +00:00
Tom Byers
7f0b207f0a Put cookies message back in
The cookie_message block was part of GOV.UK
template but is not included in the GOV.UK
Frontend template.

This adds it back in along with JS to set the
cookies from GOV.UK template and styles, taken
from the Design System's website (which I assume
has the right colour contrast).
2019-11-22 17:44:17 +00:00