refactor checkToken

This commit is contained in:
Madeline
2023-07-28 09:26:18 +10:00
parent 8a3989c297
commit f1f68c3d31
8 changed files with 11001 additions and 8202 deletions
+1 -3
View File
@@ -48,11 +48,9 @@ router.post(
async (req: Request, res: Response) => {
const { password, token } = req.body as PasswordResetSchema;
const { jwtSecret } = Config.get().security;
let user;
try {
const userTokenData = await checkToken(token, jwtSecret, true);
const userTokenData = await checkToken(token);
user = userTokenData.user;
} catch {
throw FieldErrors({
+1 -2
View File
@@ -78,11 +78,10 @@ router.post(
}
}
const { jwtSecret } = Config.get().security;
let user;
try {
const userTokenData = await checkToken(token, jwtSecret, true);
const userTokenData = await checkToken(token);
user = userTokenData.user;
} catch {
throw FieldErrors({