Set cookie expiration date

This commit is contained in:
Mattias Erming 2014-09-22 02:58:42 -07:00
parent 2fd5f293f0
commit 85988168c8
2 changed files with 25 additions and 4 deletions

View File

@ -126,7 +126,12 @@ $(function() {
}
if (data.token) {
$.cookie("token", data.token);
$.cookie(
"token",
data.token, {
expires: expire(30)
}
);
}
$("body").removeClass("signed-out");
@ -291,7 +296,12 @@ $(function() {
var self = $(this);
var name = self.attr("name");
options[name] = self.prop("checked");
$.cookie("settings", options);
$.cookie(
"settings",
options, {
expires: expire(365)
}
);
if ([
"join",
"mode",
@ -575,7 +585,12 @@ $(function() {
}
});
if (values.user) {
$.cookie("user", values.user);
$.cookie(
"user",
values.user, {
expires: expire(30)
}
);
}
socket.emit(
event, values
@ -654,6 +669,12 @@ $(function() {
location.reload();
}
function expire(days) {
var date = new Date();
date.setTime(date.getTime() + ((3600 * 1000 * 24) * days));
return date;
}
document.addEventListener(
"visibilitychange",
function() {

View File

@ -1,7 +1,7 @@
{
"name": "shout",
"description": "A web IRC client",
"version": "0.32.2",
"version": "0.32.3",
"author": "Mattias Erming",
"preferGlobal": true,
"bin": {