fix: password can be changed with wrong password
This commit is contained in:
@@ -139,7 +139,7 @@ export class AuthService {
|
|||||||
|
|
||||||
async updatePassword(user: User, newPassword: string, oldPassword?: string) {
|
async updatePassword(user: User, newPassword: string, oldPassword?: string) {
|
||||||
const isPasswordValid =
|
const isPasswordValid =
|
||||||
!user.password || !(await argon.verify(user.password, oldPassword));
|
!user.password || await argon.verify(user.password, oldPassword);
|
||||||
|
|
||||||
if (!isPasswordValid) throw new ForbiddenException("Invalid password");
|
if (!isPasswordValid) throw new ForbiddenException("Invalid password");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user