mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 07:30:20 +00:00
feat: integration user lock flow to frontend
This commit is contained in:
@@ -49,6 +49,7 @@ export const registerUserRouter = async (server: FastifyZodProvider) => {
|
||||
await server.services.user.unlockUser(req.params.userId, req.query.token);
|
||||
} catch (err) {
|
||||
logger.error(`User unlock failed for ${req.params.userId}`);
|
||||
logger.error(err);
|
||||
}
|
||||
return res.redirect(`${appCfg.SITE_URL}/login`);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export const enforceUserLockStatus = (isLocked: boolean, temporaryLockDateEnd?:
|
||||
if (timeDiff < 0)
|
||||
throw new UnauthorizedError({
|
||||
name: "User Locked",
|
||||
message: `User is locked due to multiple failed login attempts. Try logging in again after ${Math.round(
|
||||
message: `User is locked due to multiple failed login attempts. Try again after ${Math.round(
|
||||
(-1 * timeDiff) / 1000
|
||||
)} seconds.`
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ export const processFailedMfaAttempt = async (userId: string, userDAL: Pick<TUse
|
||||
const progressiveDelaysInMins = [5, 30, 60];
|
||||
|
||||
// lock user when failed attempt exceeds threshold
|
||||
if (user.consecutiveFailedMfaAttempts > PROGRESSIVE_DELAY_INTERVAL * progressiveDelaysInMins.length) {
|
||||
if (user.consecutiveFailedMfaAttempts >= PROGRESSIVE_DELAY_INTERVAL * (progressiveDelaysInMins.length + 1)) {
|
||||
return (
|
||||
await tx(TableName.Users)
|
||||
.where("id", userId)
|
||||
|
||||
Reference in New Issue
Block a user