patch dup email bug for login

This commit is contained in:
Maidul Islam
2023-06-04 11:07:52 -07:00
parent 08a4404fed
commit 3df62a6e0a
2 changed files with 2 additions and 6 deletions

View File

@@ -74,7 +74,7 @@ export const login1 = async (req: Request, res: Response) => {
// generate server-side public key
const serverPublicKey = server.getPublicKey();
await LoginSRPDetail.findOneAndReplace({
userId: user.id,
email: email
}, {
email,
userId: user.id,
@@ -125,7 +125,7 @@ export const login2 = async (req: Request, res: Response) => {
})
}
const loginSRPDetail = await LoginSRPDetail.findOneAndDelete({ userId: user.id });
const loginSRPDetail = await LoginSRPDetail.findOneAndDelete({ email: email })
if (!loginSRPDetail) {
return BadRequestError(Error("Failed to find login details for SRP"))

View File

@@ -20,10 +20,6 @@ const loginSRPDetailSchema = new Schema<ILoginSRPDetail>(
unique: true
},
serverBInt: { type: mongoose.Schema.Types.Buffer },
userId: {
type: String,
unique: true,
},
expireAt: { type: Date }
}
);