Skip to content

Commit

Permalink
fix sign token using email
Browse files Browse the repository at this point in the history
  • Loading branch information
larryrider committed Jan 30, 2024
1 parent a2b00c5 commit f7f6be2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/middleware/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f7f6be2

Please sign in to comment.