Skip to content

Commit

Permalink
Email jwt timeout (#640)
Browse files Browse the repository at this point in the history
* Use transfer courses in getting req errors (#613)

* Transfer courses add to only pre-req errors (#613)

* Format

* Set timeout on JWT in confirmation emails

* JWT token expiration time fix

* remove formatting change
  • Loading branch information
yijen-sun authored Nov 2, 2023
1 parent a719fbe commit 51fe366
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
5 changes: 3 additions & 2 deletions packages/api-v2/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ POSTGRES_PASSWORD=graduatenu
POSTGRES_DATABASE=dev
JWT_SECRET_KEY=chungusdevs
# 1 day in milliseconds (1000 x 60 x 60 x 24)
JWT_EXPIRE_TIME=86400000
JWT_EXPIRE_TIME='86400s'
PORT=3001
NODE_ENV=development
JWT_EXPIRE_TIME_EMAIL=21600
# 15 minutes in milliseconds
JWT_EXPIRE_TIME_EMAIL='900s'
EMAIL_CONFIRMATION_URL=http://localhost:3002/confirmEmail
EMAIL_SERVICE=gmail
EMAIL_USER=[insert email from notion]
Expand Down
2 changes: 1 addition & 1 deletion packages/api-v2/src/email/email.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { EmailConfirmationController } from "src/emailConfirmation/emailConfirma
JwtModule.register({
secret: process.env.JWT_SECRET_KEY,
signOptions: {
expiresIn: process.env.JWT_EXPIRE_TIME,
expiresIn: process.env.JWT_EXPIRE_TIME_EMAIL,
},
}),
],
Expand Down
12 changes: 5 additions & 7 deletions packages/frontend-v2/utils/plan/preAndCoReqCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from "@graduate/common";

export const getCoReqWarnings = (
schedule: Schedule2<unknown>,
schedule: Schedule2<unknown>
): CoReqWarnings => {
const errors: CoReqWarnings = {
type: "coreq",
Expand All @@ -30,7 +30,7 @@ export const getCoReqWarnings = (
};

export const getCoReqWarningsSem = (
term: ScheduleTerm2<unknown>,
term: ScheduleTerm2<unknown>
): TermError => {
const seen: Set<string> = new Set();
const coReqErrors: TermError = {};
Expand Down Expand Up @@ -62,8 +62,8 @@ export const getPreReqWarnings = (
spring: getPreReqWarningSem(year.spring, seen),
summer1: getPreReqWarningSem(year.summer1, seen),
summer2: getPreReqWarningSem(year.summer2, seen),
}))
}
})),
};
return preReqErrors;
};

Expand Down Expand Up @@ -135,8 +135,6 @@ const isOrCourse = (course: INEUReq): course is INEUOrReq => {
return (course as INEUOrReq).type === "or";
};

const isError = (
error: INEUReqError | undefined
): error is INEUReqError => {
const isError = (error: INEUReqError | undefined): error is INEUReqError => {
return !!error;
};

0 comments on commit 51fe366

Please sign in to comment.