diff --git a/cypress/integration/realm_settings_test.spec.ts b/cypress/integration/realm_settings_test.spec.ts index f62a56dc4b..7e956e81c5 100644 --- a/cypress/integration/realm_settings_test.spec.ts +++ b/cypress/integration/realm_settings_test.spec.ts @@ -292,6 +292,23 @@ describe("Realm settings", () => { masthead.checkNotificationMessage("Realm successfully updated"); }); + it("Brute force detection", () => { + sidebarPage.goToRealmSettings(); + cy.get("#pf-tab-securityDefences-securityDefences").click(); + cy.get("#pf-tab-20-bruteForce").click(); + + cy.findByTestId("brute-force-tab-save").should("be.disabled"); + + cy.get("#bruteForceProtected").click({ force: true }); + cy.findByTestId("waitIncrementSeconds").type("1"); + cy.findByTestId("maxFailureWaitSeconds").type("1"); + cy.findByTestId("maxDeltaTimeSeconds").type("1"); + cy.findByTestId("minimumQuickLoginWaitSeconds").type("1"); + + cy.findByTestId("brute-force-tab-save").should("be.enabled").click(); + masthead.checkNotificationMessage("Realm successfully updated"); + }); + it("add session data", () => { sidebarPage.goToRealmSettings(); diff --git a/src/realm-settings/help.ts b/src/realm-settings/help.ts index 00210a3c1e..a6df748f9f 100644 --- a/src/realm-settings/help.ts +++ b/src/realm-settings/help.ts @@ -60,13 +60,14 @@ export default { failureFactor: "How many failures before wait is triggered.", permanentLockout: "Lock the user permanently when the user exceeds the maximum login failures.", - waitIncrement: + waitIncrementSeconds: "When failure threshold has been met, how much time should the user be locked out?", - maxFailureWait: "Max time a user will be locked out.", - maxDeltaTime: "When will failure count be reset?", + maxFailureWaitSeconds: "Max time a user will be locked out.", + maxDeltaTimeSeconds: "When will failure count be reset?", quickLoginCheckMilliSeconds: "If a failure happens concurrently too quickly, lock out the user.", - minimumQuickLoginWait: "How long to wait after a quick login failure.", + minimumQuickLoginWaitSeconds: + "How long to wait after a quick login failure.", ssoSessionIdle: "Time a session is allowed to be idle before it expires. Tokens and browser sessions are invalidated when a session is expired.", ssoSessionMax: diff --git a/src/realm-settings/messages.ts b/src/realm-settings/messages.ts index d3fd96b434..9502b797b5 100644 --- a/src/realm-settings/messages.ts +++ b/src/realm-settings/messages.ts @@ -611,11 +611,11 @@ export default { strictTransportSecurity: "HTTP Strict Transport Security (HSTS)", failureFactor: "Max login failures", permanentLockout: "Permanent lockout", - waitIncrement: "Wait increment", - maxFailureWait: "Max wait", - maxDeltaTime: "Failure reset time", + waitIncrementSeconds: "Wait increment", + maxFailureWaitSeconds: "Max wait", + maxDeltaTimeSeconds: "Failure reset time", quickLoginCheckMilliSeconds: "Quick login check milliseconds", - minimumQuickLoginWait: "Minimum quick login wait", + minimumQuickLoginWaitSeconds: "Minimum quick login wait", }, "partial-import": { partialImportHeaderText: diff --git a/src/realm-settings/security-defences/BruteForceDetection.tsx b/src/realm-settings/security-defences/BruteForceDetection.tsx index 1e410c4016..9cfcaa61de 100644 --- a/src/realm-settings/security-defences/BruteForceDetection.tsx +++ b/src/realm-settings/security-defences/BruteForceDetection.tsx @@ -62,100 +62,107 @@ export const BruteForceDetection = ({ )} /> - {enable && ( - <> - - } - fieldId="failureFactor" - > - ( - onChange(value + 1)} - onMinus={() => onChange(value - 1)} - onChange={(event) => - onChange(Number((event.target as HTMLInputElement).value)) - } - /> - )} + + } + fieldId="failureFactor" + style={enable ? {} : { display: "none" }} + > + ( + onChange(value + 1)} + onMinus={() => onChange(value - 1)} + onChange={(event) => + onChange(Number((event.target as HTMLInputElement).value)) + } /> - - - ( - - )} - /> - - - {!permanentLockout && ( - <> - -