From f7f6be223d9ffa8bfa3d89d50ad55316a1926103 Mon Sep 17 00:00:00 2001 From: larry-internxt Date: Tue, 30 Jan 2024 12:01:25 +0100 Subject: [PATCH] fix sign token using email --- src/app/middleware/passport.js | 2 +- tests/e2e/e2e-spec.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/middleware/passport.js b/src/app/middleware/passport.js index 61980246..5ddf99e5 100644 --- a/src/app/middleware/passport.js +++ b/src/app/middleware/passport.js @@ -6,7 +6,7 @@ const passportAuth = passport.authenticate('jwt', { session: false }); function Sign(data, secret, expires = false) { const token = expires ? jwt.sign({ email: data, iat: getDefaultIAT() }, secret, { expiresIn: '14d' }) : - jwt.sign(Object.assign(data, { iat: getDefaultIAT() }), secret); + jwt.sign({ email: data, iat: getDefaultIAT() }, secret); return token; } diff --git a/tests/e2e/e2e-spec.ts b/tests/e2e/e2e-spec.ts index 9a83cc90..77a773ee 100644 --- a/tests/e2e/e2e-spec.ts +++ b/tests/e2e/e2e-spec.ts @@ -98,7 +98,7 @@ describe('E2E TEST', () => { userId = user.dataValues.id; rootFolderId = user.dataValues.root_folder_id; - token = Sign({ email }, server.config.get('secrets').JWT); + token = Sign(email, server.config.get('secrets').JWT); } catch (err: any) { // eslint-disable-next-line no-console console.error('Error setting up storage e2e tests: %s', err.message); @@ -943,7 +943,7 @@ describe('E2E TEST', () => { userId = user.dataValues.id; rootFolderId = user.dataValues.root_folder_id; - token = Sign({ email }, server.config.get('secrets').JWT); + token = Sign(email, server.config.get('secrets').JWT); } catch (err: any) { // eslint-disable-next-line no-console console.error('Error setting up storage e2e tests: %s', err.message);