🐛 (user) fix user check password

This commit is contained in:
unknown
2025-07-01 00:55:25 +07:00
parent e7857e0384
commit 3ef7f1a249
7 changed files with 82 additions and 19 deletions

View File

@ -51,5 +51,5 @@ export const mainErrorHandler = (set: Context["set"], error: unknown) => {
);
}
return returnErrorResponse(set, 500, "Internal server error");
return returnErrorResponse(set, 500, "Internal server error", error);
};

View File

@ -0,0 +1,13 @@
import { AppError } from "../../error/instances/app";
import bcrypt from "bcrypt";
export const comparePassword = async (
passwordInput: string,
passwordRaw: string
) => {
try {
return bcrypt.compare(passwordInput, passwordRaw);
} catch (error) {
throw new AppError(401, "Invalid credentials", error);
}
};