Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
🐛 Use Tokens.LOGIN_LINK to verify JWT
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Aug 4, 2020
1 parent cf4a8fd commit 128d995
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/_staart/rest/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export const verifyEmail = async (token: string, locals: Locals) => {
};

export const loginLink = async (token: string, locals: Locals) => {
const userId = (await verifyToken<{ id: number }>(token, Tokens.EMAIL_VERIFY))
const userId = (await verifyToken<{ id: number }>(token, Tokens.LOGIN_LINK))
.id;
const user = await prisma.users.findOne({
where: { id: userId },
Expand Down
3 changes: 1 addition & 2 deletions src/controllers/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ export class AuthController {
async postLoginLink(req: Request, res: Response) {
const token = req.body.token || req.params.token;
joiValidate({ token: Joi.string().required() }, { token });
await loginLink(token, res.locals);
return respond(RESOURCE_SUCCESS);
return loginLink(token, res.locals);
}
}

0 comments on commit 128d995

Please sign in to comment.