mirror of
https://github.com/docmost/docmost.git
synced 2025-11-10 06:32:06 +10:00
fix hash check
This commit is contained in:
@ -47,13 +47,18 @@ export class AuthService {
|
||||
includePassword: true,
|
||||
});
|
||||
|
||||
const errorMessage = 'email or password does not match';
|
||||
if (!user || user?.deletedAt) {
|
||||
throw new UnauthorizedException(errorMessage);
|
||||
}
|
||||
|
||||
const isPasswordMatch = await comparePasswordHash(
|
||||
loginDto.password,
|
||||
user?.password,
|
||||
user.password,
|
||||
);
|
||||
|
||||
if (!user || !isPasswordMatch || user.deletedAt) {
|
||||
throw new UnauthorizedException('email or password does not match');
|
||||
if (!isPasswordMatch) {
|
||||
throw new UnauthorizedException(errorMessage);
|
||||
}
|
||||
|
||||
user.lastLoginAt = new Date();
|
||||
|
||||
Reference in New Issue
Block a user