main
alex 2024-01-28 18:51:09 +01:00
parent 5c26804cc4
commit c9f0054b59
1 changed files with 4 additions and 8 deletions

View File

@ -144,10 +144,6 @@ export async function Login(req: Request, res: Response) {
}); });
if (!user) { if (!user) {
logger.debug(
"User does not exist with this accountName: %s",
accountName
);
return res.status(400).send({ err: "invalid request" }); return res.status(400).send({ err: "invalid request" });
} }
@ -156,7 +152,6 @@ export async function Login(req: Request, res: Response) {
// and only needs to enter their account name to get the user state to know what to do next // and only needs to enter their account name to get the user state to know what to do next
if (password === undefined) { if (password === undefined) {
console.debug("Password not provided");
return res.status(200).send({ state: user.state }); return res.status(200).send({ state: user.state });
} }
@ -165,7 +160,6 @@ export async function Login(req: Request, res: Response) {
const decodedPassword = decodeBase64(password); const decodedPassword = decodeBase64(password);
if (!isPasswordValid(decodedPassword)) { if (!isPasswordValid(decodedPassword)) {
logger.debug("Password is not valid");
return res.status(400).send({ err: "invalid request" }); return res.status(400).send({ err: "invalid request" });
} }
@ -174,13 +168,15 @@ export async function Login(req: Request, res: Response) {
const match = await matchPassword(decodedPassword, user.password); const match = await matchPassword(decodedPassword, user.password);
if (!match) { if (!match) {
logger.debug("Password is not valid");
return res.status(400).send({ err: "invalid request" }); return res.status(400).send({ err: "invalid request" });
} }
// check user state // check user state
if (user.state === ACCOUNT_STATE.PENDING_DELETION) { if (
user.state === ACCOUNT_STATE.PENDING_DELETION ||
user.state === ACCOUNT_STATE.INIT_LOGIN
) {
// update user state back to active // update user state back to active
User.update( User.update(