fixed login issue after mfa

This commit is contained in:
Sheen Capadngan
2023-05-24 21:33:24 +08:00
parent 422d04d7d7
commit 93cf7cde2d
2 changed files with 4 additions and 1 deletions

View File

@@ -288,6 +288,8 @@ export const verifyMfaToken = async (req: Request, res: Response) => {
if (!user) throw new Error('Failed to find user');
await LoginSRPDetail.deleteOne({ userId: user.id })
await checkUserDevice({
user,
ip: req.ip,

View File

@@ -76,6 +76,7 @@ export const login1 = async (req: Request, res: Response) => {
await LoginSRPDetail.findOneAndReplace({
userId: user.id,
}, {
email,
userId: user.id,
clientPublicKey: clientPublicKey,
serverBInt: bigintConversion.bigintToBuf(server.bInt),
@@ -115,7 +116,7 @@ export const login2 = async (req: Request, res: Response) => {
}).select('+salt +verifier +encryptionVersion +protectedKey +protectedKeyIV +protectedKeyTag +publicKey +encryptedPrivateKey +iv +tag');
if (!user) throw new Error('Failed to find user');
if (user.authProvider) {
await validateProviderAuthToken({
email,