state
parent
5c26804cc4
commit
c9f0054b59
|
@ -144,10 +144,6 @@ export async function Login(req: Request, res: Response) {
|
|||
});
|
||||
|
||||
if (!user) {
|
||||
logger.debug(
|
||||
"User does not exist with this accountName: %s",
|
||||
accountName
|
||||
);
|
||||
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
|
||||
|
||||
if (password === undefined) {
|
||||
console.debug("Password not provided");
|
||||
return res.status(200).send({ state: user.state });
|
||||
}
|
||||
|
||||
|
@ -165,7 +160,6 @@ export async function Login(req: Request, res: Response) {
|
|||
const decodedPassword = decodeBase64(password);
|
||||
|
||||
if (!isPasswordValid(decodedPassword)) {
|
||||
logger.debug("Password is not valid");
|
||||
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);
|
||||
|
||||
if (!match) {
|
||||
logger.debug("Password is not valid");
|
||||
return res.status(400).send({ err: "invalid request" });
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
User.update(
|
||||
|
|
Loading…
Reference in New Issue