Skip to content

Commit

Permalink
Change session length to 7 days
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ErisDS committed May 8, 2015
1 parent e99afc6 commit bdf5c92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions core/server/middleware/oauth.js
Expand Up @@ -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});
Expand Down Expand Up @@ -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({
Expand Down
15 changes: 8 additions & 7 deletions core/server/utils/index.js
Expand Up @@ -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`.
Expand Down

0 comments on commit bdf5c92

Please sign in to comment.