mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
misc: improved ux by requiring captcha entry before submission
This commit is contained in:
@@ -236,7 +236,7 @@ export const authLoginServiceFactory = ({
|
|||||||
|
|
||||||
if (!isValidClientProof) {
|
if (!isValidClientProof) {
|
||||||
await userDAL.update(
|
await userDAL.update(
|
||||||
{ id: userEnc.id },
|
{ id: userEnc.userId },
|
||||||
{
|
{
|
||||||
$incr: {
|
$incr: {
|
||||||
consecutiveFailedPasswordAttempts: 1
|
consecutiveFailedPasswordAttempts: 1
|
||||||
@@ -251,6 +251,11 @@ export const authLoginServiceFactory = ({
|
|||||||
serverPrivateKey: null,
|
serverPrivateKey: null,
|
||||||
clientPublicKey: null
|
clientPublicKey: null
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await userDAL.updateById(userEnc.userId, {
|
||||||
|
consecutiveFailedPasswordAttempts: 0
|
||||||
|
});
|
||||||
|
|
||||||
// send multi factor auth token if they it enabled
|
// send multi factor auth token if they it enabled
|
||||||
if (userEnc.isMfaEnabled && userEnc.email) {
|
if (userEnc.isMfaEnabled && userEnc.email) {
|
||||||
enforceUserLockStatus(Boolean(user.isLocked), user.temporaryLockDateEnd);
|
enforceUserLockStatus(Boolean(user.isLocked), user.temporaryLockDateEnd);
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ export const InitialStep = ({ setStep, email, setEmail, password, setPassword }:
|
|||||||
captchaRef.current.resetCaptcha();
|
captchaRef.current.resetCaptcha();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setCaptchaToken("");
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -274,6 +275,7 @@ export const InitialStep = ({ setStep, email, setEmail, password, setPassword }:
|
|||||||
)}
|
)}
|
||||||
<div className="mt-3 w-1/4 min-w-[21.2rem] rounded-md text-center md:min-w-[20.1rem] lg:w-1/6">
|
<div className="mt-3 w-1/4 min-w-[21.2rem] rounded-md text-center md:min-w-[20.1rem] lg:w-1/6">
|
||||||
<Button
|
<Button
|
||||||
|
disabled={shouldShowCaptcha && captchaToken === ""}
|
||||||
type="submit"
|
type="submit"
|
||||||
size="sm"
|
size="sm"
|
||||||
isFullWidth
|
isFullWidth
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ export const PasswordStep = ({
|
|||||||
if (captchaRef.current) {
|
if (captchaRef.current) {
|
||||||
captchaRef.current.resetCaptcha();
|
captchaRef.current.resetCaptcha();
|
||||||
}
|
}
|
||||||
|
setCaptchaToken("");
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -223,6 +224,7 @@ export const PasswordStep = ({
|
|||||||
)}
|
)}
|
||||||
<div className="mx-auto mt-4 flex w-1/4 w-full min-w-[22rem] items-center justify-center rounded-md text-center lg:w-1/6">
|
<div className="mx-auto mt-4 flex w-1/4 w-full min-w-[22rem] items-center justify-center rounded-md text-center lg:w-1/6">
|
||||||
<Button
|
<Button
|
||||||
|
disabled={shouldShowCaptcha && captchaToken === ""}
|
||||||
type="submit"
|
type="submit"
|
||||||
colorSchema="primary"
|
colorSchema="primary"
|
||||||
variant="outline_bg"
|
variant="outline_bg"
|
||||||
|
|||||||
Reference in New Issue
Block a user