Skip to content

Commit

Permalink
Fix bug is calculating expiration hours when creating a new token.
Browse files Browse the repository at this point in the history
    If hours were specified, the clamped value was not used.
  • Loading branch information
Misterblue committed Feb 4, 2021
1 parent cbcd8b4 commit fa1f04f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Entities/Domains.ts
Expand Up @@ -146,7 +146,7 @@ export const Domains = {
},
// Return the Date when an domain is considered inactive
dateWhenNotActive(): Date {
const notActiveTime = new Date(Date.now() - 1000 * Config["metaverse-server"]["domain-seconds-until-offline"]);
const notActiveTime = new Date(Date.now() - (1000 * Config["metaverse-server"]["domain-seconds-until-offline"] ) );
return notActiveTime;
},
// Return 'true' if the passed string could be a domainId. Used as a precheck before querying the Db.
Expand Down
4 changes: 2 additions & 2 deletions src/Entities/Tokens.ts
Expand Up @@ -82,8 +82,8 @@ export const Tokens = {
break;
default:
// There is a specification of some hours to expire
let hours = Clamp(pExpireHours, 1, 1000000); // max is 114 years
aToken.expirationTime = new Date(new Date().valueOf() + pExpireHours * 1000*60*60);
const hours = Clamp(pExpireHours, 1, 1000000); // max is 114 years
aToken.expirationTime = new Date(new Date().valueOf() + hours * 1000*60*60);
break;
};
return aToken;
Expand Down

0 comments on commit fa1f04f

Please sign in to comment.