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