From 61c0647922c6f7dc68e6f0656b1793dcd268a906 Mon Sep 17 00:00:00 2001 From: larry-internxt Date: Thu, 9 Nov 2023 14:40:43 +0100 Subject: [PATCH] added missing lastPasswordChangedAt property --- src/app/routes/auth.ts | 1 + src/app/routes/routes.ts | 1 + src/app/routes/storage.ts | 9 +++++++-- src/config/initializers/middleware.js | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/app/routes/auth.ts b/src/app/routes/auth.ts index 8a27d359..ee636ffb 100644 --- a/src/app/routes/auth.ts +++ b/src/app/routes/auth.ts @@ -200,6 +200,7 @@ export class AuthController { backupsBucket: userData.backupsBucket, avatar: userData.avatar ? await this.service.User.getSignedAvatarUrl(userData.avatar) : null, emailVerified: userData.emailVerified, + lastPasswordChangedAt: userData.lastPasswordChangedAt, }; const userTeam = null; diff --git a/src/app/routes/routes.ts b/src/app/routes/routes.ts index 5fa1972f..582663dd 100644 --- a/src/app/routes/routes.ts +++ b/src/app/routes/routes.ts @@ -106,6 +106,7 @@ export default (router: Router, service: any, App: any): Router => { backupsBucket: userData.backupsBucket, avatar: userData.avatar ? await service.User.getSignedAvatarUrl(userData.avatar) : null, emailVerified: userData.emailVerified, + lastPasswordChangedAt: userData.lastPasswordChangedAt, }; res.status(200).json({ user, token }); diff --git a/src/app/routes/storage.ts b/src/app/routes/storage.ts index 9542e468..80848a33 100644 --- a/src/app/routes/storage.ts +++ b/src/app/routes/storage.ts @@ -16,7 +16,10 @@ import { FileAlreadyExistsError, FileWithNameAlreadyExistsError } from '../services/errors/FileWithNameAlreadyExistsError'; -import { FolderAlreadyExistsError, FolderWithNameAlreadyExistsError } from '../services/errors/FolderWithNameAlreadyExistsError'; +import { + FolderAlreadyExistsError, + FolderWithNameAlreadyExistsError +} from '../services/errors/FolderWithNameAlreadyExistsError'; import * as resourceSharingMiddlewareBuilder from '../middleware/resource-sharing.middleware'; import {validate } from 'uuid'; @@ -94,7 +97,9 @@ export class StorageController { return res.status(409).send({ error: err.message }); } this.logger.error( - `[FILE/CREATE] ERROR: ${(err as Error).message}, BODY ${JSON.stringify(file)}, STACK: ${(err as Error).stack} USER: ${behalfUser.email}`, + `[FILE/CREATE] ERROR: ${(err as Error).message}, BODY ${ + JSON.stringify(file) + }, STACK: ${(err as Error).stack} USER: ${behalfUser.email}`, ); res.status(500).send({ error: 'Internal Server Error' }); } diff --git a/src/config/initializers/middleware.js b/src/config/initializers/middleware.js index ea2eb808..3cef963d 100644 --- a/src/config/initializers/middleware.js +++ b/src/config/initializers/middleware.js @@ -167,7 +167,8 @@ module.exports = (App, Config) => { .then((user) => { const userWithoutLastPasswordChangedAt = user.lastPasswordChangedAt === null; const userWithLastPasswordChangedAtLowerThanToken = - user.lastPasswordChangedAt && Math.floor(new Date(user.lastPasswordChangedAt).getTime()) / 1000 < payload.iat; + user.lastPasswordChangedAt && + Math.floor(new Date(user.lastPasswordChangedAt).getTime()) / 1000 < payload.iat; if (userWithoutLastPasswordChangedAt || userWithLastPasswordChangedAtLowerThanToken) { done(null, user); } else {