Change session length to 7 days

refs #5202

- this is just a stopgap to deliver minor improvement short term,
- longer term we will do the work to refresh refresh tokens & switch this to a month
This commit is contained in:
Hannah Wolfe 2015-05-08 15:54:12 +01:00
parent e99afc65b6
commit bdf5c9275f
2 changed files with 10 additions and 9 deletions

View File

@ -32,7 +32,7 @@ oauth = {
var accessToken = utils.uid(256),
refreshToken = utils.uid(256),
accessExpires = Date.now() + utils.ONE_HOUR_MS,
refreshExpires = Date.now() + utils.ONE_DAY_MS;
refreshExpires = Date.now() + utils.ONE_WEEK_MS;
return models.Accesstoken.add({token: accessToken, user_id: user.id, client_id: client.id, expires: accessExpires}).then(function () {
return models.Refreshtoken.add({token: refreshToken, user_id: user.id, client_id: client.id, expires: refreshExpires});
@ -62,7 +62,7 @@ oauth = {
var token = model.toJSON(),
accessToken = utils.uid(256),
accessExpires = Date.now() + utils.ONE_HOUR_MS,
refreshExpires = Date.now() + utils.ONE_DAY_MS;
refreshExpires = Date.now() + utils.ONE_WEEK_MS;
if (token.expires > Date.now()) {
models.Accesstoken.add({

View File

@ -19,13 +19,14 @@ utils = {
/**
* Timespans in seconds and milliseconds for better readability
*/
ONE_HOUR_S: 3600,
ONE_DAY_S: 86400,
ONE_YEAR_S: 31536000,
ONE_HOUR_MS: 3600000,
ONE_DAY_MS: 86400000,
ONE_MONTH_MS: 2628000000,
ONE_YEAR_MS: 31536000000,
ONE_HOUR_S: 3600,
ONE_DAY_S: 86400,
ONE_YEAR_S: 31536000,
ONE_HOUR_MS: 3600000,
ONE_DAY_MS: 86400000,
ONE_WEEK_MS: 604800000,
ONE_MONTH_MS: 2628000000,
ONE_YEAR_MS: 31536000000,
/**
* Return a unique identifier with the given `len`.