strapi-plugin-magic-sessionmanager 4.21.0 → 4.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +97 -0
- package/README.md +92 -47
- package/dist/admin/{Analytics-BqdZIBV4.js → Analytics-B7BAjApz.js} +1 -1
- package/dist/admin/{Analytics-C-OLLzoB.mjs → Analytics-CIHgaURb.mjs} +1 -1
- package/dist/admin/{App-BswHmNQT.mjs → App-CPE-CQGz.mjs} +1309 -2564
- package/dist/admin/{App-Cx9v6n_7.js → App-DJkJC06E.js} +1336 -2591
- package/dist/admin/{OnlineUsersWidget-BRmQPPp9.js → OnlineUsersWidget-CcjNfzzf.js} +1 -1
- package/dist/admin/{OnlineUsersWidget-Dusgjc1d.mjs → OnlineUsersWidget-Dou2hxGY.mjs} +1 -1
- package/dist/admin/{Settings-DWGuf_Z3.js → Settings--eEiHv_a.js} +104 -81
- package/dist/admin/{Settings-DZyQheUS.mjs → Settings-h_exWUiI.mjs} +62 -39
- package/dist/admin/dashboardModel-DNT_l-Bk.js +169 -0
- package/dist/admin/dashboardModel-fApbKGay.mjs +170 -0
- package/dist/admin/{de-DUnrmFWk.mjs → de-Wz5Emtrb.mjs} +79 -7
- package/dist/admin/{de-24TPqzG6.js → de-oBmcAcXj.js} +79 -7
- package/dist/admin/{en-8mBSkWOF.js → en-B1TN5F62.js} +80 -8
- package/dist/admin/{en-D8J__tyF.mjs → en-B_1Ka64U.mjs} +80 -8
- package/dist/admin/{es-ChUKey-Q.js → es-Bb515J0p.js} +79 -7
- package/dist/admin/{es-BgpgWdk0.mjs → es-CVgw4zsj.mjs} +79 -7
- package/dist/admin/{fr-k1MHYKJo.mjs → fr-0AgMxTFc.mjs} +79 -7
- package/dist/admin/{fr-DE_CWmgq.js → fr-yDdwunmg.js} +79 -7
- package/dist/admin/index-DVQ7tdTC.mjs +4746 -0
- package/dist/admin/index-qtN2dOm4.js +4747 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/{pt-BjqU5ioB.js → pt-BAB07LY-.js} +79 -7
- package/dist/admin/{pt-DPO4DmDc.mjs → pt-DtM74ffN.mjs} +79 -7
- package/dist/server/index.js +1487 -438
- package/dist/server/index.mjs +1487 -438
- package/package.json +4 -3
- package/dist/admin/index-Ceh3Q1Ki.js +0 -2308
- package/dist/admin/index-meLDPPwt.mjs +0 -2307
- package/dist/admin/settingsTabs-C1q5iMMw.mjs +0 -437
- package/dist/admin/settingsTabs-CfquZuKH.js +0 -436
|
@@ -7,7 +7,7 @@ const styled = require("styled-components");
|
|
|
7
7
|
const designSystem = require("@strapi/design-system");
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
const StrapiAdmin = require("@strapi/strapi/admin");
|
|
10
|
-
const index = require("./index-
|
|
10
|
+
const index = require("./index-qtN2dOm4.js");
|
|
11
11
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
12
12
|
function _interopNamespace(e) {
|
|
13
13
|
if (e && e.__esModule) return e;
|
|
@@ -6,7 +6,7 @@ import { Flex, Loader, Button, Box, Typography } from "@strapi/design-system";
|
|
|
6
6
|
import { User, Lightning, Clock, Lock, WarningCircle } from "@strapi/icons";
|
|
7
7
|
import * as StrapiAdmin from "@strapi/strapi/admin";
|
|
8
8
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
9
|
-
import { l as logSafeAdminError,
|
|
9
|
+
import { l as logSafeAdminError, F as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-DVQ7tdTC.mjs";
|
|
10
10
|
function normalizeUserCounts(response) {
|
|
11
11
|
const totalUsers = response?.data?.totalUsers;
|
|
12
12
|
const blockedUsers = response?.data?.blockedUsers;
|
|
@@ -6,10 +6,10 @@ const designSystem = require("@strapi/design-system");
|
|
|
6
6
|
const StrapiAdmin = require("@strapi/strapi/admin");
|
|
7
7
|
const icons = require("@strapi/icons");
|
|
8
8
|
const styled = require("styled-components");
|
|
9
|
-
const index = require("./index-
|
|
9
|
+
const index = require("./index-qtN2dOm4.js");
|
|
10
10
|
require("react-intl");
|
|
11
|
-
const settingsTabs = require("./settingsTabs-CfquZuKH.js");
|
|
12
11
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
12
|
+
const dashboardModel = require("./dashboardModel-DNT_l-Bk.js");
|
|
13
13
|
const symbols = require("@strapi/icons/symbols");
|
|
14
14
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
15
15
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
@@ -405,7 +405,7 @@ const SettingsTabLink = ({ tab, children }) => {
|
|
|
405
405
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
406
406
|
TabLink,
|
|
407
407
|
{
|
|
408
|
-
href:
|
|
408
|
+
href: index.buildTabSearch(search, tab),
|
|
409
409
|
onClick: (event) => {
|
|
410
410
|
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0)
|
|
411
411
|
return;
|
|
@@ -488,7 +488,7 @@ const PresetSelect = ({
|
|
|
488
488
|
disabled = false
|
|
489
489
|
}) => {
|
|
490
490
|
const { custom } = useOptionLabels();
|
|
491
|
-
const options =
|
|
491
|
+
const options = index.buildSelectOptions(presets, value);
|
|
492
492
|
return /* @__PURE__ */ jsxRuntime.jsx(FormField, { id, name, label, description, error, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
493
493
|
designSystem.SingleSelect,
|
|
494
494
|
{
|
|
@@ -571,6 +571,7 @@ const ROLE_RULE_RANGES = Object.freeze({
|
|
|
571
571
|
});
|
|
572
572
|
const ROLE_RULE_FIELDS = Object.freeze(Object.keys(ROLE_RULE_RANGES));
|
|
573
573
|
const MAX_TRUSTED_ADDRESSES = 100;
|
|
574
|
+
const MAX_TRUSTED_PROXIES = 50;
|
|
574
575
|
const message$2 = (messageId, defaultMessage, values) => ({ messageId, defaultMessage, values });
|
|
575
576
|
function validateWholeNumber(value, { min, max }) {
|
|
576
577
|
if (value === void 0 || value === null || value === "") {
|
|
@@ -613,17 +614,24 @@ function validatePolicyFields(settings) {
|
|
|
613
614
|
const error = validateWholeNumber(source[key], range);
|
|
614
615
|
if (error) errors[key] = error;
|
|
615
616
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
617
|
+
for (const [field, max] of [
|
|
618
|
+
["lockoutTrustedAddresses", MAX_TRUSTED_ADDRESSES],
|
|
619
|
+
["trustedProxies", MAX_TRUSTED_PROXIES]
|
|
620
|
+
]) {
|
|
621
|
+
const entries = Array.isArray(source[field]) ? source[field] : [];
|
|
622
|
+
if (entries.length > max) {
|
|
623
|
+
errors[field] = message$2(
|
|
624
|
+
"settings.validation.trustedTooMany",
|
|
625
|
+
"Enter at most {max} addresses.",
|
|
626
|
+
{
|
|
627
|
+
max
|
|
628
|
+
}
|
|
629
|
+
);
|
|
630
|
+
continue;
|
|
631
|
+
}
|
|
624
632
|
const invalid = entries.find((entry) => !isTrustedAddressLine(entry));
|
|
625
633
|
if (invalid !== void 0) {
|
|
626
|
-
errors
|
|
634
|
+
errors[field] = message$2(
|
|
627
635
|
"settings.validation.trustedAddress",
|
|
628
636
|
'"{value}" is not an IP address or CIDR range. Use for example 192.0.2.10 or 192.0.2.0/24.',
|
|
629
637
|
{ value: String(invalid).slice(0, 64) }
|
|
@@ -684,7 +692,7 @@ function sortLocks(locks) {
|
|
|
684
692
|
}
|
|
685
693
|
const TABLE_MIN_WIDTH$2 = 640;
|
|
686
694
|
const keepActionKeys$2 = (event) => {
|
|
687
|
-
if (
|
|
695
|
+
if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
688
696
|
};
|
|
689
697
|
const EMPTY_DRAFT = Object.freeze({
|
|
690
698
|
role: "",
|
|
@@ -712,7 +720,7 @@ const RoleRulesSection = ({ form }) => {
|
|
|
712
720
|
const [showErrors, setShowErrors] = react.useState(false);
|
|
713
721
|
const addRef = react.useRef(null);
|
|
714
722
|
const returnFocusRef = react.useRef(null);
|
|
715
|
-
const [widthRef, width] =
|
|
723
|
+
const [widthRef, width] = index.useElementWidth();
|
|
716
724
|
react.useEffect(() => {
|
|
717
725
|
let active = true;
|
|
718
726
|
get(`/${index.pluginId}/roles`).then(({ data }) => {
|
|
@@ -773,7 +781,7 @@ const RoleRulesSection = ({ form }) => {
|
|
|
773
781
|
const asTable = width === 0 || width >= TABLE_MIN_WIDTH$2;
|
|
774
782
|
const actions = (rule) => {
|
|
775
783
|
const name = roleName(rule.role);
|
|
776
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
784
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(dashboardModel.RowActions, { onKeyDown: keepActionKeys$2, children: [
|
|
777
785
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
778
786
|
designSystem.IconButton,
|
|
779
787
|
{
|
|
@@ -1044,7 +1052,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1044
1052
|
"A session unused for this long becomes idle and ends as 'Timed out' on its next request or at the next idle check. Also decides who counts as online."
|
|
1045
1053
|
),
|
|
1046
1054
|
value: settings.inactivityTimeout,
|
|
1047
|
-
presets:
|
|
1055
|
+
presets: index.SELECT_PRESETS.inactivityTimeout,
|
|
1048
1056
|
format: units.minutes,
|
|
1049
1057
|
onChange: (value) => handleChange("inactivityTimeout", value)
|
|
1050
1058
|
}
|
|
@@ -1060,7 +1068,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1060
1068
|
"Counted from sign-in, regardless of activity. Applied on the session's next request; until then the session can still show as active or idle."
|
|
1061
1069
|
),
|
|
1062
1070
|
value: settings.maxSessionAgeDays,
|
|
1063
|
-
presets:
|
|
1071
|
+
presets: index.SELECT_PRESETS.maxSessionAgeDays,
|
|
1064
1072
|
format: units.days,
|
|
1065
1073
|
onChange: (value) => handleChange("maxSessionAgeDays", value)
|
|
1066
1074
|
}
|
|
@@ -1082,7 +1090,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1082
1090
|
"Lower values make 'Last active' and idle detection more precise but write to the database more often."
|
|
1083
1091
|
),
|
|
1084
1092
|
value: settings.lastSeenRateLimit,
|
|
1085
|
-
presets:
|
|
1093
|
+
presets: index.SELECT_PRESETS.lastSeenRateLimit,
|
|
1086
1094
|
format: units.seconds,
|
|
1087
1095
|
onChange: (value) => handleChange("lastSeenRateLimit", value)
|
|
1088
1096
|
}
|
|
@@ -1103,7 +1111,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1103
1111
|
"The idle check ends idle sessions as 'Timed out'. It deletes nothing. It also runs once at server start."
|
|
1104
1112
|
),
|
|
1105
1113
|
value: settings.cleanupInterval,
|
|
1106
|
-
presets:
|
|
1114
|
+
presets: index.SELECT_PRESETS.cleanupInterval,
|
|
1107
1115
|
format: units.minutes,
|
|
1108
1116
|
onChange: (value) => handleChange("cleanupInterval", value)
|
|
1109
1117
|
}
|
|
@@ -1190,7 +1198,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1190
1198
|
"Accepts a new token for a few seconds while its session record is being created. Only for tokens without a session record. Not used when Strapi's refresh-token mode (jwtManagement: 'refresh') is on."
|
|
1191
1199
|
),
|
|
1192
1200
|
value: settings.sessionCreationGraceMs ?? 5e3,
|
|
1193
|
-
presets:
|
|
1201
|
+
presets: index.SELECT_PRESETS.sessionCreationGraceMs,
|
|
1194
1202
|
format: units.graceMs,
|
|
1195
1203
|
onChange: (value) => handleChange("sessionCreationGraceMs", value)
|
|
1196
1204
|
}
|
|
@@ -2072,7 +2080,8 @@ const SETTINGS_DEFAULTS = Object.freeze({
|
|
|
2072
2080
|
sessionCreationGraceMs: 5e3,
|
|
2073
2081
|
cleanupUseDbDirect: false,
|
|
2074
2082
|
strictSessionEnforcement: false,
|
|
2075
|
-
|
|
2083
|
+
// Proxy addresses or CIDR ranges (4.22.1); empty = Strapi's server.proxy settings.
|
|
2084
|
+
trustedProxies: [],
|
|
2076
2085
|
enableGeolocation: true,
|
|
2077
2086
|
enableSecurityScoring: true,
|
|
2078
2087
|
blockSuspiciousSessions: false,
|
|
@@ -2133,6 +2142,7 @@ function normalizeSettings(loaded) {
|
|
|
2133
2142
|
allowedCountries: Array.isArray(loaded.allowedCountries) ? loaded.allowedCountries : [],
|
|
2134
2143
|
blockedCountries: Array.isArray(loaded.blockedCountries) ? loaded.blockedCountries : [],
|
|
2135
2144
|
lockoutTrustedAddresses: Array.isArray(loaded.lockoutTrustedAddresses) ? loaded.lockoutTrustedAddresses : [],
|
|
2145
|
+
trustedProxies: Array.isArray(loaded.trustedProxies) ? loaded.trustedProxies : [],
|
|
2136
2146
|
roleRules: Array.isArray(loaded.roleRules) ? loaded.roleRules : [],
|
|
2137
2147
|
webhookEvents: Array.isArray(loaded.webhookEvents) ? loaded.webhookEvents : [...SIGNALS_FORM_DEFAULTS.webhookEvents],
|
|
2138
2148
|
emailTemplates: fillMissingTemplates(loaded.emailTemplates)
|
|
@@ -2231,7 +2241,7 @@ function getAdjustedFields(submitted, stored, previous) {
|
|
|
2231
2241
|
}
|
|
2232
2242
|
const TABLE_MIN_WIDTH$1 = 640;
|
|
2233
2243
|
const keepActionKeys$1 = (event) => {
|
|
2234
|
-
if (
|
|
2244
|
+
if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
2235
2245
|
};
|
|
2236
2246
|
const LockTarget = ({ lock }) => {
|
|
2237
2247
|
const { t } = index.useSettingsTranslate();
|
|
@@ -2293,7 +2303,7 @@ const LockedNowCard = () => {
|
|
|
2293
2303
|
isLoading: permissionsLoading,
|
|
2294
2304
|
allowedActions: { canUnlock }
|
|
2295
2305
|
} = StrapiAdmin.useRBAC(index.pluginPermissions.lockoutsUnlock);
|
|
2296
|
-
const [widthRef, width] =
|
|
2306
|
+
const [widthRef, width] = index.useElementWidth();
|
|
2297
2307
|
const [locks, setLocks] = react.useState(null);
|
|
2298
2308
|
const [error, setError] = react.useState(false);
|
|
2299
2309
|
const [refreshing, setRefreshing] = react.useState(false);
|
|
@@ -2417,7 +2427,7 @@ const LockedNowCard = () => {
|
|
|
2417
2427
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(KindBadge, { kind: lock.kind }) }),
|
|
2418
2428
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: lock.failures }) }),
|
|
2419
2429
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: ends(lock) }),
|
|
2420
|
-
showActions ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2430
|
+
showActions ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) }) }) : null
|
|
2421
2431
|
] }, lock.id)) })
|
|
2422
2432
|
] }) });
|
|
2423
2433
|
} else {
|
|
@@ -2440,7 +2450,7 @@ const LockedNowCard = () => {
|
|
|
2440
2450
|
}) })
|
|
2441
2451
|
] })
|
|
2442
2452
|
] }),
|
|
2443
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2453
|
+
/* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) })
|
|
2444
2454
|
] })
|
|
2445
2455
|
},
|
|
2446
2456
|
lock.id
|
|
@@ -2498,37 +2508,43 @@ const LockedNowCard = () => {
|
|
|
2498
2508
|
}
|
|
2499
2509
|
);
|
|
2500
2510
|
};
|
|
2501
|
-
const TrustedAddressesField = ({
|
|
2511
|
+
const TrustedAddressesField = ({
|
|
2512
|
+
form,
|
|
2513
|
+
disabled = false,
|
|
2514
|
+
field = "lockoutTrustedAddresses",
|
|
2515
|
+
id = "lockout-trusted-addresses",
|
|
2516
|
+
label,
|
|
2517
|
+
description,
|
|
2518
|
+
placeholder = "192.0.2.0/24"
|
|
2519
|
+
}) => {
|
|
2502
2520
|
const { t, tError } = index.useSettingsTranslate();
|
|
2503
2521
|
const { settings, handleChange, errors, draftVersion } = form;
|
|
2504
|
-
const [text, setText] = react.useState(
|
|
2505
|
-
() => formatTrustedAddressText(settings.lockoutTrustedAddresses)
|
|
2506
|
-
);
|
|
2522
|
+
const [text, setText] = react.useState(() => formatTrustedAddressText(settings[field]));
|
|
2507
2523
|
const [version, setVersion] = react.useState(draftVersion);
|
|
2508
2524
|
if (version !== draftVersion) {
|
|
2509
2525
|
setVersion(draftVersion);
|
|
2510
|
-
setText(formatTrustedAddressText(settings
|
|
2526
|
+
setText(formatTrustedAddressText(settings[field]));
|
|
2511
2527
|
}
|
|
2512
2528
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2513
2529
|
FormField,
|
|
2514
2530
|
{
|
|
2515
|
-
id
|
|
2516
|
-
name:
|
|
2517
|
-
label: t("settings.config.failed.trusted.label", "Trusted addresses"),
|
|
2518
|
-
description: t(
|
|
2531
|
+
id,
|
|
2532
|
+
name: field,
|
|
2533
|
+
label: label ?? t("settings.config.failed.trusted.label", "Trusted addresses"),
|
|
2534
|
+
description: description ?? t(
|
|
2519
2535
|
"settings.config.failed.trusted.hint",
|
|
2520
2536
|
"One IP address or CIDR range per line, for example 192.0.2.10 or 192.0.2.0/24. These addresses are never locked by IP; accounts can still be locked. Use it for an office network or a server that signs in for many users."
|
|
2521
2537
|
),
|
|
2522
|
-
error: tError(errors
|
|
2538
|
+
error: tError(errors[field]),
|
|
2523
2539
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2524
2540
|
designSystem.Textarea,
|
|
2525
2541
|
{
|
|
2526
2542
|
value: text,
|
|
2527
|
-
placeholder
|
|
2543
|
+
placeholder,
|
|
2528
2544
|
disabled,
|
|
2529
2545
|
onChange: (event) => {
|
|
2530
2546
|
setText(event.target.value);
|
|
2531
|
-
handleChange(
|
|
2547
|
+
handleChange(field, parseTrustedAddressText(event.target.value));
|
|
2532
2548
|
}
|
|
2533
2549
|
}
|
|
2534
2550
|
)
|
|
@@ -2612,7 +2628,7 @@ const ImpossibleTravelCard = ({ form }) => {
|
|
|
2612
2628
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2613
2629
|
AdvancedSection,
|
|
2614
2630
|
{
|
|
2615
|
-
hasError:
|
|
2631
|
+
hasError: index.fieldHasError(errors, "impossibleTravelSpeedKmh") || index.fieldHasError(errors, "impossibleTravelMinDistanceKm"),
|
|
2616
2632
|
disabled: !enabled,
|
|
2617
2633
|
children: /* @__PURE__ */ jsxRuntime.jsxs(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: [
|
|
2618
2634
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3117,8 +3133,8 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3117
3133
|
const lookupOff = !settings.enableGeolocation;
|
|
3118
3134
|
const locked = form.canChangeProtected === false;
|
|
3119
3135
|
const policyLocked = locked;
|
|
3120
|
-
const risk =
|
|
3121
|
-
const reject =
|
|
3136
|
+
const risk = dashboardModel.getRiskAvailability(form.geoIp.status);
|
|
3137
|
+
const reject = dashboardModel.riskDependentControl(settings.blockSuspiciousSessions, risk.state);
|
|
3122
3138
|
const autoStillRejects = reject.savedOnButInactive && (settings.geoLookupFailureMode || "auto") === "auto";
|
|
3123
3139
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
3124
3140
|
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
@@ -3152,6 +3168,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3152
3168
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3153
3169
|
designSystem.NumberInput,
|
|
3154
3170
|
{
|
|
3171
|
+
disabled: policyLocked,
|
|
3155
3172
|
value: settings.maxFailedLogins,
|
|
3156
3173
|
onValueChange: (value) => handleChange("maxFailedLogins", value),
|
|
3157
3174
|
min: MAX_FAILED_LOGINS_RANGE.min,
|
|
@@ -3297,7 +3314,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3297
3314
|
AdvancedSection,
|
|
3298
3315
|
{
|
|
3299
3316
|
label: t("settings.config.failed.trusted.section", "Trusted addresses"),
|
|
3300
|
-
hasError:
|
|
3317
|
+
hasError: index.fieldHasError(errors, "lockoutTrustedAddresses"),
|
|
3301
3318
|
children: /* @__PURE__ */ jsxRuntime.jsx(TrustedAddressesField, { form, disabled: policyLocked })
|
|
3302
3319
|
}
|
|
3303
3320
|
)
|
|
@@ -3305,7 +3322,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3305
3322
|
}
|
|
3306
3323
|
),
|
|
3307
3324
|
/* @__PURE__ */ jsxRuntime.jsx(LockedNowCard, {}),
|
|
3308
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3325
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3309
3326
|
SectionCard.SectionCard,
|
|
3310
3327
|
{
|
|
3311
3328
|
id: "client-ip-address",
|
|
@@ -3314,19 +3331,24 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3314
3331
|
"settings.config.clientIp.intro",
|
|
3315
3332
|
"All IP-based rules depend on reading the real client address."
|
|
3316
3333
|
),
|
|
3317
|
-
children:
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
"
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3334
|
+
children: [
|
|
3335
|
+
policyLocked ? /* @__PURE__ */ jsxRuntime.jsx(ProtectedNotice, {}) : null,
|
|
3336
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3337
|
+
TrustedAddressesField,
|
|
3338
|
+
{
|
|
3339
|
+
form,
|
|
3340
|
+
disabled: policyLocked,
|
|
3341
|
+
field: "trustedProxies",
|
|
3342
|
+
id: "trusted-proxies",
|
|
3343
|
+
placeholder: "10.0.0.0/8",
|
|
3344
|
+
label: t("settings.config.clientIp.trustProxy.label", "Trusted proxies"),
|
|
3345
|
+
description: t(
|
|
3346
|
+
"settings.config.clientIp.trustProxy.hint",
|
|
3347
|
+
"Leave empty to use Strapi's server.proxy settings (koa, ipHeader, maxIpsCount). Otherwise list your proxies, one IP address or CIDR range per line: only a request that comes from a listed proxy has its X-Forwarded-For read, and the client is the right-most address that is not listed. Affects the recorded IP address, the IP lockout and location lookups."
|
|
3348
|
+
)
|
|
3349
|
+
}
|
|
3350
|
+
)
|
|
3351
|
+
]
|
|
3330
3352
|
}
|
|
3331
3353
|
),
|
|
3332
3354
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3368,7 +3390,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3368
3390
|
children: !lookupOff && reject.disabled ? /* @__PURE__ */ jsxRuntime.jsx(RiskSourceNotice, { savedOn: reject.savedOnButInactive }) : null
|
|
3369
3391
|
}
|
|
3370
3392
|
),
|
|
3371
|
-
/* @__PURE__ */ jsxRuntime.jsxs(AdvancedSection, { hasError:
|
|
3393
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AdvancedSection, { hasError: index.fieldHasError(errors, "geoLookupFailureMode"), children: [
|
|
3372
3394
|
/* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3373
3395
|
FormField,
|
|
3374
3396
|
{
|
|
@@ -3510,7 +3532,7 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
3510
3532
|
};
|
|
3511
3533
|
const lookupOff = !settings.enableGeolocation;
|
|
3512
3534
|
const locked = form.canChangeProtected === false;
|
|
3513
|
-
const localDatabase =
|
|
3535
|
+
const localDatabase = index.usesLocalDatabase(settings.geoIpProvider);
|
|
3514
3536
|
const databaseDisabled = lookupOff || !localDatabase;
|
|
3515
3537
|
const credentialSource = geoIpStatus?.credentialSource;
|
|
3516
3538
|
const fromEnvironment = credentialSource === "env";
|
|
@@ -3727,7 +3749,7 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
3727
3749
|
"Save your changes first, so the download uses the current settings."
|
|
3728
3750
|
) }) : null
|
|
3729
3751
|
] }),
|
|
3730
|
-
/* @__PURE__ */ jsxRuntime.jsx(AdvancedSection, { hasError:
|
|
3752
|
+
/* @__PURE__ */ jsxRuntime.jsx(AdvancedSection, { hasError: index.fieldHasError(errors, "geoIpDatabasePath"), children: /* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3731
3753
|
FormField,
|
|
3732
3754
|
{
|
|
3733
3755
|
id: "geoip-database-filename",
|
|
@@ -3830,7 +3852,7 @@ const RiskDataCard = ({ form }) => {
|
|
|
3830
3852
|
const { t } = index.useSettingsTranslate();
|
|
3831
3853
|
const { settings, geoIp } = form;
|
|
3832
3854
|
const lookupOff = !settings.enableGeolocation;
|
|
3833
|
-
const risk =
|
|
3855
|
+
const risk = dashboardModel.getRiskAvailability(geoIp.status);
|
|
3834
3856
|
const sourceLabels = {
|
|
3835
3857
|
"anonymous-ip": t("settings.config.risk.source.anonymousIp", "Anonymous IP database"),
|
|
3836
3858
|
"asn-heuristic": t("settings.config.risk.source.asn", "ASN heuristic")
|
|
@@ -3897,8 +3919,8 @@ const RiskDataCard = ({ form }) => {
|
|
|
3897
3919
|
const LocationDataTab = ({ form }) => {
|
|
3898
3920
|
const { t } = index.useSettingsTranslate();
|
|
3899
3921
|
const { settings, handleChange } = form;
|
|
3900
|
-
const risk =
|
|
3901
|
-
const scoring =
|
|
3922
|
+
const risk = dashboardModel.getRiskAvailability(form.geoIp.status);
|
|
3923
|
+
const scoring = dashboardModel.riskDependentControl(settings.enableSecurityScoring, risk.state);
|
|
3902
3924
|
const locked = form.canChangeProtected === false;
|
|
3903
3925
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
3904
3926
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
@@ -4719,8 +4741,8 @@ const AlertsTab = ({ form }) => {
|
|
|
4719
4741
|
const emailTypesDisabled = lookupOff || !settings.enableEmailAlerts;
|
|
4720
4742
|
const webhookFieldsDisabled = lookupOff || !settings.enableWebhooks;
|
|
4721
4743
|
const locked = form.canChangeProtected === false;
|
|
4722
|
-
const templateErrors =
|
|
4723
|
-
const risk =
|
|
4744
|
+
const templateErrors = index.fieldHasError(errors, "emailTemplates");
|
|
4745
|
+
const risk = dashboardModel.getRiskAvailability(form.geoIp.status);
|
|
4724
4746
|
const emailTypes = [
|
|
4725
4747
|
{
|
|
4726
4748
|
field: "alertOnSuspiciousLogin",
|
|
@@ -4807,7 +4829,7 @@ const AlertsTab = ({ form }) => {
|
|
|
4807
4829
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", tag: "div", textColor: "neutral800", children: t("settings.config.email.types.label", "Send an email for") }),
|
|
4808
4830
|
!lookupOff && !settings.enableEmailAlerts ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.emailAlerts", "Requires Send security emails") }) : null,
|
|
4809
4831
|
/* @__PURE__ */ jsxRuntime.jsx(EmailTypeGrid, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: emailTypes.map(({ field, needsRiskData, needsTravel, hintId, label, hint }) => {
|
|
4810
|
-
const control = needsRiskData ?
|
|
4832
|
+
const control = needsRiskData ? dashboardModel.riskDependentControl(settings[field], risk.state) : { checked: settings[field], disabled: false, savedOnButInactive: false };
|
|
4811
4833
|
const travelOff = needsTravel && settings.impossibleTravelEnabled !== true;
|
|
4812
4834
|
const disabled = emailTypesDisabled || control.disabled || travelOff;
|
|
4813
4835
|
return /* @__PURE__ */ jsxRuntime.jsxs(AlertTypeCell, { checked: control.checked, disabled, children: [
|
|
@@ -4827,12 +4849,13 @@ const AlertsTab = ({ form }) => {
|
|
|
4827
4849
|
] }, field);
|
|
4828
4850
|
}) }) })
|
|
4829
4851
|
] }),
|
|
4852
|
+
locked ? /* @__PURE__ */ jsxRuntime.jsx(ProtectedNotice, {}) : null,
|
|
4830
4853
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4831
4854
|
AdvancedSection,
|
|
4832
4855
|
{
|
|
4833
4856
|
label: t("settings.config.email.templates.label", "Edit email templates"),
|
|
4834
4857
|
hasError: templateErrors,
|
|
4835
|
-
disabled: emailTypesDisabled,
|
|
4858
|
+
disabled: emailTypesDisabled || locked,
|
|
4836
4859
|
children: [
|
|
4837
4860
|
/* @__PURE__ */ jsxRuntime.jsx(index.PersistentAlert, { variant: "warning", closeLabel: t("common.close", "Close"), title: "", children: t(
|
|
4838
4861
|
"settings.config.email.templates.warning",
|
|
@@ -4995,7 +5018,7 @@ const DataRetentionTab = ({ form }) => {
|
|
|
4995
5018
|
"Checked once a day, the first time about 24 hours after the server starts. Open sessions are never deleted by retention. 'Forever' keeps them."
|
|
4996
5019
|
),
|
|
4997
5020
|
value: settings.retentionDays,
|
|
4998
|
-
presets:
|
|
5021
|
+
presets: index.SELECT_PRESETS.retentionDays,
|
|
4999
5022
|
format: units.retentionDays,
|
|
5000
5023
|
onChange: (value) => handleChange("retentionDays", value)
|
|
5001
5024
|
}
|
|
@@ -5191,7 +5214,7 @@ const AdminActivityTab = ({ form }) => {
|
|
|
5191
5214
|
"At least 7 days. Older events are deleted once a day; each deletion is itself recorded. Events of a deleted admin are deleted with the account."
|
|
5192
5215
|
),
|
|
5193
5216
|
value: settings.securityLogRetentionDays,
|
|
5194
|
-
presets:
|
|
5217
|
+
presets: index.SELECT_PRESETS.securityLogRetentionDays,
|
|
5195
5218
|
format: units.days,
|
|
5196
5219
|
disabled: locked,
|
|
5197
5220
|
onChange: (value) => handleChange("securityLogRetentionDays", value)
|
|
@@ -5204,14 +5227,14 @@ const AdminActivityTab = ({ form }) => {
|
|
|
5204
5227
|
};
|
|
5205
5228
|
const TABLE_MIN_WIDTH = 720;
|
|
5206
5229
|
const keepActionKeys = (event) => {
|
|
5207
|
-
if (
|
|
5230
|
+
if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
5208
5231
|
};
|
|
5209
5232
|
const ActiveImpersonationsCard = () => {
|
|
5210
5233
|
const { t } = index.useSettingsTranslate();
|
|
5211
5234
|
const { get, post } = StrapiAdmin.useFetchClient();
|
|
5212
5235
|
const { toggleNotification } = StrapiAdmin.useNotification();
|
|
5213
5236
|
const { formatDate } = index.useSessionFormatters();
|
|
5214
|
-
const [widthRef, width] =
|
|
5237
|
+
const [widthRef, width] = index.useElementWidth();
|
|
5215
5238
|
const [rows, setRows] = react.useState(null);
|
|
5216
5239
|
const [error, setError] = react.useState(false);
|
|
5217
5240
|
const [refreshing, setRefreshing] = react.useState(false);
|
|
@@ -5342,7 +5365,7 @@ const ActiveImpersonationsCard = () => {
|
|
|
5342
5365
|
}
|
|
5343
5366
|
) }),
|
|
5344
5367
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: time(row.expiresAt) }),
|
|
5345
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5368
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) }) })
|
|
5346
5369
|
] }, row.id)) })
|
|
5347
5370
|
] }) });
|
|
5348
5371
|
} else {
|
|
@@ -5367,7 +5390,7 @@ const ActiveImpersonationsCard = () => {
|
|
|
5367
5390
|
time: formatDate(row.expiresAt, { hour: "2-digit", minute: "2-digit" })
|
|
5368
5391
|
}) })
|
|
5369
5392
|
] }),
|
|
5370
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5393
|
+
/* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) })
|
|
5371
5394
|
] }) }, row.id)) });
|
|
5372
5395
|
}
|
|
5373
5396
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5478,7 +5501,7 @@ function useSettingsForm() {
|
|
|
5478
5501
|
const hasChanges = !areSettingsEqual(settings, savedSettings);
|
|
5479
5502
|
const errors = react.useMemo(() => validateSettings(settings), [settings]);
|
|
5480
5503
|
const errorCount = Object.keys(errors).length;
|
|
5481
|
-
const errorTab =
|
|
5504
|
+
const errorTab = index.getErrorTab(errors);
|
|
5482
5505
|
const canSave = hasChanges && errorCount === 0 && !saving;
|
|
5483
5506
|
const settingsRef = react.useRef(settings);
|
|
5484
5507
|
const savedSettingsRef = react.useRef(savedSettings);
|
|
@@ -5570,7 +5593,7 @@ function useSettingsForm() {
|
|
|
5570
5593
|
});
|
|
5571
5594
|
}, []);
|
|
5572
5595
|
const handleSave = react.useCallback(async () => {
|
|
5573
|
-
const submitted =
|
|
5596
|
+
const submitted = index.buildSavePayload(settingsRef.current, savedSettingsRef.current);
|
|
5574
5597
|
const previous = savedSettingsRef.current;
|
|
5575
5598
|
if (Object.keys(validateSettings(submitted)).length > 0) return false;
|
|
5576
5599
|
setSaving(true);
|
|
@@ -5590,7 +5613,7 @@ function useSettingsForm() {
|
|
|
5590
5613
|
setDraftVersion((version) => version + 1);
|
|
5591
5614
|
const adjustedNames = [
|
|
5592
5615
|
...new Set(
|
|
5593
|
-
getAdjustedFields(submitted, stored, previous).map((key) =>
|
|
5616
|
+
getAdjustedFields(submitted, stored, previous).map((key) => index.SETTINGS_FIELD_LABELS[key]).filter(Boolean).map(([id, defaultMessage]) => t(id, defaultMessage))
|
|
5594
5617
|
)
|
|
5595
5618
|
];
|
|
5596
5619
|
toggleNotification({
|
|
@@ -5827,7 +5850,7 @@ const DraftSync = ({ values }) => {
|
|
|
5827
5850
|
const writeTabToAddressBar = (tab) => {
|
|
5828
5851
|
if (typeof window === "undefined" || !window.history?.replaceState) return;
|
|
5829
5852
|
const { pathname, search, hash } = window.location;
|
|
5830
|
-
const nextSearch =
|
|
5853
|
+
const nextSearch = index.buildTabSearch(search, tab);
|
|
5831
5854
|
if (nextSearch === search) return;
|
|
5832
5855
|
window.history.replaceState(window.history.state, "", `${pathname}${nextSearch}${hash}`);
|
|
5833
5856
|
};
|
|
@@ -5842,10 +5865,10 @@ const SettingsPage = () => {
|
|
|
5842
5865
|
allowedActions: { canUpdate: canChangeProtected }
|
|
5843
5866
|
} = StrapiAdmin.useRBAC(index.pluginPermissions.settingsUpdate);
|
|
5844
5867
|
const visibleTabs = react.useMemo(
|
|
5845
|
-
() =>
|
|
5868
|
+
() => index.getVisibleSettingsTabs(Boolean(canViewAdminActivity)),
|
|
5846
5869
|
[canViewAdminActivity]
|
|
5847
5870
|
);
|
|
5848
|
-
const requestedTab =
|
|
5871
|
+
const requestedTab = index.resolveSettingsTab(query?.tab, visibleTabs);
|
|
5849
5872
|
const [activeTab, setActiveTab] = react.useState(requestedTab);
|
|
5850
5873
|
const [followedTab, setFollowedTab] = react.useState(requestedTab);
|
|
5851
5874
|
const tabsRef = react.useRef(null);
|
|
@@ -5857,7 +5880,7 @@ const SettingsPage = () => {
|
|
|
5857
5880
|
const list = tabsRef.current?.querySelector('[role="tablist"]');
|
|
5858
5881
|
const tab = list?.querySelector('[role="tab"][aria-selected="true"]');
|
|
5859
5882
|
if (!list || !tab) return;
|
|
5860
|
-
const delta =
|
|
5883
|
+
const delta = index.getRevealScrollDelta(list.getBoundingClientRect(), tab.getBoundingClientRect());
|
|
5861
5884
|
if (delta) list.scrollLeft += delta;
|
|
5862
5885
|
}, [activeTab, form.loading]);
|
|
5863
5886
|
const focusActiveTab = react.useCallback(() => {
|
|
@@ -5874,7 +5897,7 @@ const SettingsPage = () => {
|
|
|
5874
5897
|
}, [handleSave, focusActiveTab]);
|
|
5875
5898
|
const changeTab = react.useCallback(
|
|
5876
5899
|
(tab) => {
|
|
5877
|
-
const next =
|
|
5900
|
+
const next = index.resolveSettingsTab(tab, visibleTabs);
|
|
5878
5901
|
setActiveTab(next);
|
|
5879
5902
|
writeTabToAddressBar(next);
|
|
5880
5903
|
},
|
|
@@ -5964,7 +5987,7 @@ const SettingsPage = () => {
|
|
|
5964
5987
|
SettingsTabsList,
|
|
5965
5988
|
{
|
|
5966
5989
|
"aria-label": t("settings.config.tabs.label", "Configuration sections"),
|
|
5967
|
-
children: visibleTabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(SettingsTabTrigger, { value: tab, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsTabLabel, { children: t(
|
|
5990
|
+
children: visibleTabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(SettingsTabTrigger, { value: tab, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsTabLabel, { children: t(index.SETTINGS_TAB_LABELS[tab][0], index.SETTINGS_TAB_LABELS[tab][1]) }) }, tab))
|
|
5968
5991
|
}
|
|
5969
5992
|
),
|
|
5970
5993
|
visibleTabs.map((tab) => {
|