fix: token renewal date

This commit is contained in:
NGPixel 2020-07-05 14:16:16 -04:00
parent c9a1a1ad40
commit 31661b2cb3
2 changed files with 8 additions and 2 deletions

View File

@ -20,6 +20,9 @@ mssql)
sleep 30 sleep 30
docker exec db /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password123!" -Q 'CREATE DATABASE wiki' docker exec db /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password123!" -Q 'CREATE DATABASE wiki'
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mssql" -e "DB_HOST=localhost" -e "DB_PORT=1433" -e "DB_NAME=wiki" -e "DB_USER=SA" -e "DB_PASS=Password123!" requarks/wiki:canary-$BUILD_BUILDNUMBER docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mssql" -e "DB_HOST=localhost" -e "DB_PORT=1433" -e "DB_NAME=wiki" -e "DB_USER=SA" -e "DB_PASS=Password123!" requarks/wiki:canary-$BUILD_BUILDNUMBER
docker logs wiki
sleep 15
docker logs wiki
;; ;;
sqlite) sqlite)
echo "Using SQLite..." echo "Using SQLite..."

View File

@ -114,9 +114,12 @@ module.exports = {
let mustRevalidate = false let mustRevalidate = false
// Expired but still valid within N days, just renew // Expired but still valid within N days, just renew
if (info instanceof Error && info.name === 'TokenExpiredError' && DateTime.utc().minus(ms(WIKI.config.auth.tokenRenewal)) < DateTime.fromISO(info.expiredAt)) { if (info instanceof Error && info.name === 'TokenExpiredError') {
const expiredDate = (info.expiredAt instanceof Date) ? info.expiredAt.toISOString() : info.expiredAt
if (DateTime.utc().minus(ms(WIKI.config.auth.tokenRenewal)) < DateTime.fromISO(expiredDate)) {
mustRevalidate = true mustRevalidate = true
} }
}
// Check if user / group is in revocation list // Check if user / group is in revocation list
if (user && !mustRevalidate) { if (user && !mustRevalidate) {