-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ CH 1896 ] Change Cookie TTL to 1 year #3
Conversation
Nice! Are you up for adding a test? |
src/constructorio-id.js
Outdated
@@ -15,6 +15,7 @@ | |||
cookie_name: 'ConstructorioID_client_id', | |||
cookie_prefix_for_experiment: 'ConstructorioID_experiment_', | |||
cookie_domain: null, | |||
cookie_time_to_live: 365, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe cookie_days_to_live
for clarity?
src/constructorio-id.js
Outdated
@@ -46,7 +47,10 @@ | |||
|
|||
ConstructorioID.prototype.set_cookie = function (name, value) { | |||
if (!this.on_node && this.persist) { | |||
var cookie_data = name + '=' + value + '; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/'; | |||
var expires = new Date(); | |||
expires.setTime(expires.getTime() + (this.cookie_time_to_live * 24 * 60 * 60 * 1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified to
var expires = new Date(Date.now() + this.cookie_time_to_live * 24 * 60 * 60 * 1000);
src/constructorio-id.js
Outdated
@@ -46,7 +47,8 @@ | |||
|
|||
ConstructorioID.prototype.set_cookie = function (name, value) { | |||
if (!this.on_node && this.persist) { | |||
var cookie_data = name + '=' + value + '; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/'; | |||
var expires = new Date(Date.now() + this.cookie_time_to_live * 24 * 60 * 60 * 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't match option name, results in InvalidDate
No description provided.