Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

patch dup email bug for login

Maidul Islam3df62a6e0a61
diff --git a/backend/src/controllers/v3/authController.ts b/backend/src/controllers/v3/authController.ts
index a50561774d..61edffb420 100644
--- a/backend/src/controllers/v3/authController.ts
+++ b/backend/src/controllers/v3/authController.ts
@@ -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"))
diff --git a/backend/src/models/loginSRPDetail.ts b/backend/src/models/loginSRPDetail.ts
index 0cd3ed1d8d..dde59233d0 100644
--- a/backend/src/models/loginSRPDetail.ts
+++ b/backend/src/models/loginSRPDetail.ts
@@ -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 }
}
);