fixed issue with req.accessToken

This commit is contained in:
Andris Reinman 2019-08-28 10:03:56 +03:00
parent e4a20f3f4f
commit b26a749e70
4 changed files with 4 additions and 4 deletions

View file

@ -189,7 +189,7 @@ module.exports = (db, server, userHandler) => {
return next();
}
if (disabled2fa && typeof req.accessToken.update === 'function') {
if (disabled2fa && req.accessToken && typeof req.accessToken.update === 'function') {
try {
// update access token data for current session after U2F enabled
await req.accessToken.update();

View file

@ -208,7 +208,7 @@ module.exports = (db, server, userHandler) => {
return next();
}
if (disabled2fa && typeof req.accessToken.update === 'function') {
if (disabled2fa && req.accessToken && typeof req.accessToken.update === 'function') {
try {
// update access token data for current session after U2F enabled
await req.accessToken.update();

View file

@ -158,7 +158,7 @@ module.exports = (db, server, userHandler) => {
return next();
}
if (disabled2fa && typeof req.accessToken.update === 'function') {
if (disabled2fa && req.accessToken && typeof req.accessToken.update === 'function') {
try {
// update access token data for current session after U2F enabled
await req.accessToken.update();

View file

@ -1511,7 +1511,7 @@ module.exports = (db, server, userHandler) => {
}
let { success, passwordChanged } = updateResponse || {};
if (passwordChanged && typeof req.accessToken.update === 'function') {
if (passwordChanged && req.accessToken && typeof req.accessToken.update === 'function') {
try {
// update access token data for current session after password change
await req.accessToken.update();