Skip to content

Commit

Permalink
Update userController.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Sep 17, 2023
1 parent 55955f8 commit 89b9878
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/src/controllers/userController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ export async function checkToken(req: Request, res: Response) {
})

if (user) {
const type = req.params.type as bookcarsTypes.AppType
const type = req.params.type.toLowerCase() as bookcarsTypes.AppType

if (
![bookcarsTypes.AppType.Frontend, bookcarsTypes.AppType.Backend].includes(type) ||
(type === bookcarsTypes.AppType.Backend && user.type === bookcarsTypes.UserType.User) ||
Expand Down Expand Up @@ -274,7 +275,8 @@ export async function resend(req: Request, res: Response) {
const user = await User.findOne({ email })

if (user) {
const type = req.params.type as bookcarsTypes.AppType
const type = req.params.type.toLowerCase() as bookcarsTypes.AppType

if (
![bookcarsTypes.AppType.Frontend, bookcarsTypes.AppType.Backend].includes(type) ||
(type === bookcarsTypes.AppType.Backend && user.type === bookcarsTypes.UserType.User) ||
Expand Down Expand Up @@ -357,7 +359,7 @@ export async function signin(req: Request, res: Response) {

try {
const user = await User.findOne({ email })
const type = req.params.type as bookcarsTypes.AppType
const type = req.params.type.toLowerCase() as bookcarsTypes.AppType

if (
!password ||
Expand Down

0 comments on commit 89b9878

Please sign in to comment.