mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 21:27:10 +00:00
patch dup email bug for login
This commit is contained in:
@@ -74,7 +74,7 @@ export const login1 = async (req: Request, res: Response) => {
|
|||||||
// generate server-side public key
|
// generate server-side public key
|
||||||
const serverPublicKey = server.getPublicKey();
|
const serverPublicKey = server.getPublicKey();
|
||||||
await LoginSRPDetail.findOneAndReplace({
|
await LoginSRPDetail.findOneAndReplace({
|
||||||
userId: user.id,
|
email: email
|
||||||
}, {
|
}, {
|
||||||
email,
|
email,
|
||||||
userId: user.id,
|
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) {
|
if (!loginSRPDetail) {
|
||||||
return BadRequestError(Error("Failed to find login details for SRP"))
|
return BadRequestError(Error("Failed to find login details for SRP"))
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ const loginSRPDetailSchema = new Schema<ILoginSRPDetail>(
|
|||||||
unique: true
|
unique: true
|
||||||
},
|
},
|
||||||
serverBInt: { type: mongoose.Schema.Types.Buffer },
|
serverBInt: { type: mongoose.Schema.Types.Buffer },
|
||||||
userId: {
|
|
||||||
type: String,
|
|
||||||
unique: true,
|
|
||||||
},
|
|
||||||
expireAt: { type: Date }
|
expireAt: { type: Date }
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user