fix(core): Initialize JWT Secret before it's used anywhere (#7707)

HELP-394
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-11-15 12:17:18 +01:00
committed by GitHub
parent 5aee2b768f
commit 3460eb5eeb
7 changed files with 75 additions and 53 deletions

View File

@@ -63,7 +63,7 @@ export class UserService {
}
generatePasswordResetToken(user: User, expiresIn = '20m') {
return this.jwtService.signData(
return this.jwtService.sign(
{ sub: user.id, passwordSha: createPasswordSha(user) },
{ expiresIn },
);
@@ -82,7 +82,7 @@ export class UserService {
async resolvePasswordResetToken(token: string): Promise<User | undefined> {
let decodedToken: JwtPayload & { passwordSha: string };
try {
decodedToken = this.jwtService.verifyToken(token);
decodedToken = this.jwtService.verify(token);
} catch (e) {
if (e instanceof TokenExpiredError) {
this.logger.debug('Reset password token expired', { token });