mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 00:31:25 +10:00
address some issues
This commit is contained in:
@ -52,7 +52,7 @@ export default defineEventHandler(async (h3) => {
|
|||||||
|
|
||||||
// if using old auth schema
|
// if using old auth schema
|
||||||
if (Array.isArray(authMek.credentials)) {
|
if (Array.isArray(authMek.credentials)) {
|
||||||
const hash = authMek.credentials.at(1);
|
const hash = authMek.credentials.at(1)?.toString();
|
||||||
|
|
||||||
if (!hash)
|
if (!hash)
|
||||||
throw createError({
|
throw createError({
|
||||||
@ -61,7 +61,7 @@ export default defineEventHandler(async (h3) => {
|
|||||||
"Invalid password state. Please contact the server administrator.",
|
"Invalid password state. Please contact the server administrator.",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!(await checkHashBcrypt(password, hash.toString())))
|
if (!(await checkHashBcrypt(password, hash)))
|
||||||
throw createError({
|
throw createError({
|
||||||
statusCode: 401,
|
statusCode: 401,
|
||||||
statusMessage: "Invalid username or password.",
|
statusMessage: "Invalid username or password.",
|
||||||
@ -79,8 +79,9 @@ export default defineEventHandler(async (h3) => {
|
|||||||
console.error(creds.summary);
|
console.error(creds.summary);
|
||||||
|
|
||||||
throw createError({
|
throw createError({
|
||||||
statusCode: 400,
|
statusCode: 403,
|
||||||
statusMessage: creds.summary,
|
statusMessage:
|
||||||
|
"Invalid password state. Please contact the server administrator.",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user