Commit 1afd9958 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Improve token formatting.

parent cfb5d936
......@@ -2704,13 +2704,19 @@ function formatToken(token, details) {
if(token.group)
togroup = ' to group ' + token.group;
}
let since = '';
if(token["not-before"])
since = ` since ${(new Date(token['not-before'])).toLocaleString()}`
/** @type{Date} */
let expires = null;
if(token.expires)
expires = new Date(token.expires);
let until = '';
if(token.expires) {
expires = new Date(token.expires)
until = ` until ${expires.toLocaleString()}`;
}
return [
(expires && (expires >= new Date())) ?
`Invitation${foruser}${togroup}${by} valid until ${expires.toLocaleString()}` :
`Invitation${foruser}${togroup}${by} valid${since}${until}` :
`Expired invitation${foruser}${togroup}${by}`,
url.toString(),
];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment