strapi-plugin-magic-sessionmanager 4.14.3 → 4.16.0
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 +87 -0
- package/README.md +216 -85
- package/dist/admin/{Analytics-CFEgpg-G.mjs → Analytics-D4gsVwL0.mjs} +1 -1
- package/dist/admin/{Analytics-DSpn7W5A.js → Analytics-me4qzS0I.js} +1 -1
- package/dist/admin/{App-BBne8xI6.mjs → App-BJwtFWxl.mjs} +921 -106
- package/dist/admin/{App-UlRrLKcx.js → App-BTG-2Q26.js} +920 -105
- package/dist/admin/{OnlineUsersWidget-GFcYyZ9L.js → OnlineUsersWidget-DYS3Vy1Q.js} +1 -1
- package/dist/admin/{OnlineUsersWidget-C3YMTEGD.mjs → OnlineUsersWidget-Yd283YDy.mjs} +1 -1
- package/dist/admin/{Settings-BbUNvjno.mjs → Settings-DIlvfdjZ.mjs} +427 -83
- package/dist/admin/{Settings-DVhW9XHB.js → Settings-TPZ9_75s.js} +425 -81
- package/dist/admin/{de-B0CBR1Dw.js → de-BuMw1gBJ.js} +130 -8
- package/dist/admin/{de-BlKn1pSD.mjs → de-DB9ldYwN.mjs} +130 -8
- package/dist/admin/{en-IT0YTY8f.mjs → en-BbLMPQB3.mjs} +130 -8
- package/dist/admin/{en-D0ZGIIjz.js → en-BqGhOJDy.js} +130 -8
- package/dist/admin/{es-CWee-XCR.js → es-BaIeckl9.js} +130 -8
- package/dist/admin/{es-BCGzaaCh.mjs → es-C5iaiE9G.mjs} +130 -8
- package/dist/admin/{fr-xBIH4Byq.mjs → fr-BEvBUCwI.mjs} +130 -8
- package/dist/admin/{fr-rQS1M7jE.js → fr-D1YKyTex.js} +130 -8
- package/dist/admin/{index-1KmiZSfy.js → index-CgZiLcJ1.js} +13 -10
- package/dist/admin/{index-MOJkFXcZ.mjs → index-DUESEUaO.mjs} +13 -10
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pt-DWDeIDVa.mjs → pt-DeDih9cR.mjs} +130 -8
- package/dist/admin/{pt-C-yTLhnS.js → pt-DtnW-s0V.js} +130 -8
- package/dist/admin/riskData-BVs9GpgD.js +26 -0
- package/dist/admin/riskData-CI1gm2yI.mjs +27 -0
- package/dist/server/index.js +2500 -299
- package/dist/server/index.mjs +2500 -299
- package/package.json +1 -1
- package/scripts/geoip-updater.cjs +58 -15
|
@@ -6,9 +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-CgZiLcJ1.js");
|
|
10
10
|
const reactIntl = require("react-intl");
|
|
11
11
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
12
|
+
const riskData = require("./riskData-BVs9GpgD.js");
|
|
12
13
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
13
14
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
14
15
|
const SETTINGS_TAB_IDS = Object.freeze([
|
|
@@ -16,15 +17,18 @@ const SETTINGS_TAB_IDS = Object.freeze([
|
|
|
16
17
|
"login-protection",
|
|
17
18
|
"location-data",
|
|
18
19
|
"alerts",
|
|
19
|
-
"data-retention"
|
|
20
|
+
"data-retention",
|
|
21
|
+
"admin-activity"
|
|
20
22
|
]);
|
|
23
|
+
const PERMISSION_GATED_TABS = Object.freeze(["admin-activity"]);
|
|
21
24
|
const DEFAULT_SETTINGS_TAB = "sessions";
|
|
22
25
|
const SETTINGS_TAB_LABELS = Object.freeze({
|
|
23
26
|
sessions: ["settings.config.tab.sessions", "Sessions"],
|
|
24
27
|
"login-protection": ["settings.config.tab.loginProtection", "Login protection"],
|
|
25
28
|
"location-data": ["settings.config.tab.locationData", "Location data"],
|
|
26
29
|
alerts: ["settings.config.tab.alerts", "Alerts"],
|
|
27
|
-
"data-retention": ["settings.config.tab.dataRetention", "Data and retention"]
|
|
30
|
+
"data-retention": ["settings.config.tab.dataRetention", "Data and retention"],
|
|
31
|
+
"admin-activity": ["settings.config.tab.adminActivity", "Admin activity"]
|
|
28
32
|
});
|
|
29
33
|
const SETTINGS_TAB_FIELDS = Object.freeze({
|
|
30
34
|
sessions: [
|
|
@@ -61,7 +65,14 @@ const SETTINGS_TAB_FIELDS = Object.freeze({
|
|
|
61
65
|
"discordWebhookUrl",
|
|
62
66
|
"slackWebhookUrl"
|
|
63
67
|
],
|
|
64
|
-
"data-retention": ["retentionDays"]
|
|
68
|
+
"data-retention": ["retentionDays"],
|
|
69
|
+
"admin-activity": [
|
|
70
|
+
"adminSignInHistory",
|
|
71
|
+
"adminContentActivity",
|
|
72
|
+
"securityLogStoreIp",
|
|
73
|
+
"securityLogAnonymizeIp",
|
|
74
|
+
"securityLogRetentionDays"
|
|
75
|
+
]
|
|
65
76
|
});
|
|
66
77
|
const PRESERVED_SETTINGS_KEYS = Object.freeze([
|
|
67
78
|
"rateLimitWriteMax",
|
|
@@ -104,7 +115,21 @@ const SETTINGS_FIELD_LABELS = Object.freeze({
|
|
|
104
115
|
enableWebhooks: ["settings.config.webhooks.enable.label", "Send team notifications"],
|
|
105
116
|
discordWebhookUrl: ["settings.config.webhooks.discord.label", "Discord webhook URL"],
|
|
106
117
|
slackWebhookUrl: ["settings.config.webhooks.slack.label", "Slack webhook URL"],
|
|
107
|
-
retentionDays: ["settings.config.retention.keep.label", "Keep ended sessions for"]
|
|
118
|
+
retentionDays: ["settings.config.retention.keep.label", "Keep ended sessions for"],
|
|
119
|
+
adminSignInHistory: ["settings.config.adminActivity.signIns.label", "Record admin sign-ins"],
|
|
120
|
+
adminContentActivity: [
|
|
121
|
+
"settings.config.adminActivity.content.label",
|
|
122
|
+
"Record Content Manager activity"
|
|
123
|
+
],
|
|
124
|
+
securityLogStoreIp: ["settings.config.adminActivity.storeIp.label", "Store IP addresses"],
|
|
125
|
+
securityLogAnonymizeIp: [
|
|
126
|
+
"settings.config.adminActivity.anonymize.label",
|
|
127
|
+
"Anonymise the last part of IP addresses"
|
|
128
|
+
],
|
|
129
|
+
securityLogRetentionDays: [
|
|
130
|
+
"settings.config.adminActivity.retention.label",
|
|
131
|
+
"Keep security events for"
|
|
132
|
+
]
|
|
108
133
|
});
|
|
109
134
|
const SELECT_PRESETS = Object.freeze({
|
|
110
135
|
inactivityTimeout: Object.freeze([5, 10, 15, 30, 60, 120]),
|
|
@@ -112,11 +137,17 @@ const SELECT_PRESETS = Object.freeze({
|
|
|
112
137
|
lastSeenRateLimit: Object.freeze([10, 30, 60, 120, 300]),
|
|
113
138
|
cleanupInterval: Object.freeze([15, 30, 60, 120]),
|
|
114
139
|
sessionCreationGraceMs: Object.freeze([0, 2e3, 5e3, 1e4, 3e4]),
|
|
115
|
-
retentionDays: Object.freeze([7, 30, 60, 90, 180, 365, -1])
|
|
140
|
+
retentionDays: Object.freeze([7, 30, 60, 90, 180, 365, -1]),
|
|
141
|
+
securityLogRetentionDays: Object.freeze([7, 30, 90, 180, 365])
|
|
116
142
|
});
|
|
117
|
-
function resolveSettingsTab(value) {
|
|
143
|
+
function resolveSettingsTab(value, tabs = SETTINGS_TAB_IDS) {
|
|
118
144
|
const candidate = Array.isArray(value) ? value[0] : value;
|
|
119
|
-
return
|
|
145
|
+
return tabs.includes(candidate) ? candidate : DEFAULT_SETTINGS_TAB;
|
|
146
|
+
}
|
|
147
|
+
function getVisibleSettingsTabs(canViewAdminActivity) {
|
|
148
|
+
return SETTINGS_TAB_IDS.filter(
|
|
149
|
+
(tab) => canViewAdminActivity || !PERMISSION_GATED_TABS.includes(tab)
|
|
150
|
+
);
|
|
120
151
|
}
|
|
121
152
|
function buildTabSearch(search, tab) {
|
|
122
153
|
const params = new URLSearchParams(typeof search === "string" ? search : "");
|
|
@@ -593,6 +624,16 @@ const RequiresGeolocation = () => {
|
|
|
593
624
|
const { t } = useSettingsTranslate();
|
|
594
625
|
return /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { tab: "location-data", children: t("settings.config.requires.geolocation", "Requires IP location lookup") });
|
|
595
626
|
};
|
|
627
|
+
const RiskSourceNotice = ({ savedOn = false, tab = "location-data" }) => {
|
|
628
|
+
const { t } = useSettingsTranslate();
|
|
629
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, "data-risk-source-notice": "", children: [
|
|
630
|
+
/* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { tab: tab || void 0, children: t("settings.config.requires.riskData", "Needs a risk data source") }),
|
|
631
|
+
savedOn ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t(
|
|
632
|
+
"settings.config.requires.riskData.savedOn",
|
|
633
|
+
"Saved as on. It takes effect once a risk data source is set up."
|
|
634
|
+
) }) : null
|
|
635
|
+
] });
|
|
636
|
+
};
|
|
596
637
|
const AdvancedTrigger = styled__default.default(designSystem.Accordion.Trigger)`
|
|
597
638
|
&&:focus-visible {
|
|
598
639
|
outline: 2px solid ${({ theme }) => theme.colors.primary600};
|
|
@@ -1368,7 +1409,12 @@ const SETTINGS_DEFAULTS = Object.freeze({
|
|
|
1368
1409
|
blockedCountries: [],
|
|
1369
1410
|
geoIpProvider: "auto",
|
|
1370
1411
|
geoIpDatabasePath: "",
|
|
1371
|
-
geoLookupFailureMode: "auto"
|
|
1412
|
+
geoLookupFailureMode: "auto",
|
|
1413
|
+
adminSignInHistory: true,
|
|
1414
|
+
adminContentActivity: false,
|
|
1415
|
+
securityLogStoreIp: true,
|
|
1416
|
+
securityLogAnonymizeIp: false,
|
|
1417
|
+
securityLogRetentionDays: 90
|
|
1372
1418
|
});
|
|
1373
1419
|
const MAX_FAILED_LOGINS_RANGE = Object.freeze({ min: 0, max: 100 });
|
|
1374
1420
|
const WEBHOOK_HOSTS = Object.freeze({
|
|
@@ -1883,6 +1929,9 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
1883
1929
|
const maxFailedError = tError(errors.maxFailedLogins);
|
|
1884
1930
|
const maxFailedValue = Number(settings.maxFailedLogins);
|
|
1885
1931
|
const lookupOff = !settings.enableGeolocation;
|
|
1932
|
+
const risk = riskData.getRiskAvailability(form.geoIp.status);
|
|
1933
|
+
const reject = riskData.riskDependentControl(settings.blockSuspiciousSessions, risk.state);
|
|
1934
|
+
const autoStillRejects = reject.savedOnButInactive && (settings.geoLookupFailureMode || "auto") === "auto";
|
|
1886
1935
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
1887
1936
|
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
1888
1937
|
"settings.config.loginProtection.intro",
|
|
@@ -1982,6 +2031,23 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
1982
2031
|
subtitle: t("settings.config.suspicious.intro", "Refuses new sign-ins that look risky."),
|
|
1983
2032
|
children: [
|
|
1984
2033
|
lookupOff ? /* @__PURE__ */ jsxRuntime.jsx(RequiresGeolocation, {}) : null,
|
|
2034
|
+
!lookupOff && risk.state === "missing" ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2035
|
+
index.PersistentAlert,
|
|
2036
|
+
{
|
|
2037
|
+
variant: "default",
|
|
2038
|
+
closeLabel: t("common.close", "Close"),
|
|
2039
|
+
title: t("settings.config.risk.missing.title", "No risk data source"),
|
|
2040
|
+
"data-risk-missing": "",
|
|
2041
|
+
children: [
|
|
2042
|
+
t(
|
|
2043
|
+
"settings.config.risk.missing.body",
|
|
2044
|
+
"VPN, proxy and Tor detection needs a risk data source. Until one is set up, no sign-in is refused as suspicious."
|
|
2045
|
+
),
|
|
2046
|
+
" ",
|
|
2047
|
+
/* @__PURE__ */ jsxRuntime.jsx(SettingsTabLink, { tab: "location-data", children: t("settings.config.risk.missing.link", "Set up risk data") })
|
|
2048
|
+
]
|
|
2049
|
+
}
|
|
2050
|
+
) : null,
|
|
1985
2051
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1986
2052
|
SettingsToggleRow,
|
|
1987
2053
|
{
|
|
@@ -1989,45 +2055,48 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
1989
2055
|
title: t("settings.config.suspicious.reject.label", "Reject suspicious sign-ins"),
|
|
1990
2056
|
description: t(
|
|
1991
2057
|
"settings.config.suspicious.reject.hint",
|
|
1992
|
-
"Refuses sign-ins from VPN, proxy or
|
|
2058
|
+
"Refuses sign-ins from VPN, proxy or Tor addresses and, with security scoring on, scores below 50. Hosting networks only trigger alerts."
|
|
1993
2059
|
),
|
|
1994
|
-
checked:
|
|
1995
|
-
disabled: lookupOff,
|
|
2060
|
+
checked: reject.checked,
|
|
2061
|
+
disabled: lookupOff || reject.disabled,
|
|
1996
2062
|
onChange: (checked) => handleChange("blockSuspiciousSessions", checked),
|
|
1997
|
-
children:
|
|
1998
|
-
"settings.config.suspicious.reject.localNote",
|
|
1999
|
-
"The local database has no VPN, proxy or threat data and always scores 100, so only failed lookups can be refused."
|
|
2000
|
-
) }) : null
|
|
2063
|
+
children: !lookupOff && reject.disabled ? /* @__PURE__ */ jsxRuntime.jsx(RiskSourceNotice, { savedOn: reject.savedOnButInactive }) : null
|
|
2001
2064
|
}
|
|
2002
2065
|
),
|
|
2003
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2066
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AdvancedSection, { hasError: fieldHasError(errors, "geoLookupFailureMode"), children: [
|
|
2067
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2068
|
+
FormField,
|
|
2069
|
+
{
|
|
2070
|
+
id: "geoip-lookup-failure-mode",
|
|
2071
|
+
name: "geoLookupFailureMode",
|
|
2072
|
+
label: t(
|
|
2073
|
+
"settings.config.suspicious.failureMode.label",
|
|
2074
|
+
"If the location cannot be determined"
|
|
2075
|
+
),
|
|
2076
|
+
description: t(
|
|
2077
|
+
"settings.config.suspicious.failureMode.hint",
|
|
2078
|
+
"Automatic rejects only when 'Reject suspicious sign-ins' is on. A rejected sign-in gets 'Login temporarily unavailable'. With 'Reject sign-in', the Automatic provider no longer falls back to ipapi.co."
|
|
2079
|
+
),
|
|
2080
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2081
|
+
designSystem.SingleSelect,
|
|
2082
|
+
{
|
|
2083
|
+
value: settings.geoLookupFailureMode || "auto",
|
|
2084
|
+
disabled: lookupOff,
|
|
2085
|
+
onChange: (value) => handleChange("geoLookupFailureMode", value),
|
|
2086
|
+
children: [
|
|
2087
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "auto", children: t("settings.config.suspicious.failureMode.auto", "Automatic") }),
|
|
2088
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "allow", children: t("settings.config.suspicious.failureMode.allow", "Allow sign-in") }),
|
|
2089
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "block", children: t("settings.config.suspicious.failureMode.block", "Reject sign-in") })
|
|
2090
|
+
]
|
|
2091
|
+
}
|
|
2092
|
+
)
|
|
2093
|
+
}
|
|
2094
|
+
) }),
|
|
2095
|
+
autoStillRejects ? /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral700", tag: "p", "data-auto-still-rejects": "", children: t(
|
|
2096
|
+
"settings.config.suspicious.failureMode.savedOnNote",
|
|
2097
|
+
"Automatic still rejects sign-ins whose location cannot be determined, because 'Reject suspicious sign-ins' is saved as on. Choose 'Allow sign-in' to change that."
|
|
2098
|
+
) }) : null
|
|
2099
|
+
] })
|
|
2031
2100
|
]
|
|
2032
2101
|
}
|
|
2033
2102
|
),
|
|
@@ -2092,7 +2161,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
2092
2161
|
] })
|
|
2093
2162
|
] });
|
|
2094
2163
|
};
|
|
2095
|
-
const BUILD_DATE_OPTIONS$
|
|
2164
|
+
const BUILD_DATE_OPTIONS$2 = Object.freeze({ dateStyle: "medium" });
|
|
2096
2165
|
const PathValue = ({ path }) => {
|
|
2097
2166
|
const parts = String(path).split("/");
|
|
2098
2167
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: parts.map((part, index2) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
@@ -2203,7 +2272,7 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
2203
2272
|
geoIpStatus.metadata?.lastModified,
|
|
2204
2273
|
locale,
|
|
2205
2274
|
"",
|
|
2206
|
-
BUILD_DATE_OPTIONS$
|
|
2275
|
+
BUILD_DATE_OPTIONS$2
|
|
2207
2276
|
)
|
|
2208
2277
|
},
|
|
2209
2278
|
{
|
|
@@ -2366,9 +2435,149 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
2366
2435
|
}
|
|
2367
2436
|
);
|
|
2368
2437
|
};
|
|
2438
|
+
const BUILD_DATE_OPTIONS$1 = Object.freeze({ dateStyle: "medium" });
|
|
2439
|
+
const databaseState = (entry) => {
|
|
2440
|
+
if (entry?.usable) return "ready";
|
|
2441
|
+
if (entry?.exists) return "unusable";
|
|
2442
|
+
return "missing";
|
|
2443
|
+
};
|
|
2444
|
+
const BADGE_COLOURS = Object.freeze({
|
|
2445
|
+
ready: { backgroundColor: "success100", textColor: "success700" },
|
|
2446
|
+
unusable: { backgroundColor: "warning200", textColor: "neutral800" },
|
|
2447
|
+
missing: { backgroundColor: "neutral150", textColor: "neutral700" }
|
|
2448
|
+
});
|
|
2449
|
+
const RiskDatabase = ({ id, title, shortName, description, entry, form, lookupOff }) => {
|
|
2450
|
+
const { t, locale } = useSettingsTranslate();
|
|
2451
|
+
const buttonRef = react.useRef(null);
|
|
2452
|
+
const { geoIp } = form;
|
|
2453
|
+
const state = databaseState(entry);
|
|
2454
|
+
const stateLabels = {
|
|
2455
|
+
ready: t("settings.config.risk.database.ready", "Ready"),
|
|
2456
|
+
unusable: t("settings.config.risk.database.unusable", "Cannot be read"),
|
|
2457
|
+
missing: t("settings.config.risk.database.missing", "Not downloaded")
|
|
2458
|
+
};
|
|
2459
|
+
const built = index.formatSessionDate(entry?.metadata?.lastModified, locale, "", BUILD_DATE_OPTIONS$1);
|
|
2460
|
+
const pending = geoIp.riskUpdating === id;
|
|
2461
|
+
const disabled = lookupOff || Boolean(geoIp.riskUpdating) || geoIp.updating || !geoIp.status?.hasCredentials || entry?.fromEnvironment === true;
|
|
2462
|
+
const download = async () => {
|
|
2463
|
+
await geoIp.updateDatabase(false, id);
|
|
2464
|
+
window.requestAnimationFrame(
|
|
2465
|
+
() => window.requestAnimationFrame(() => index.refocusIfLost(buttonRef.current, buttonRef.current))
|
|
2466
|
+
);
|
|
2467
|
+
};
|
|
2468
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2469
|
+
designSystem.Box,
|
|
2470
|
+
{
|
|
2471
|
+
padding: 4,
|
|
2472
|
+
hasRadius: true,
|
|
2473
|
+
borderColor: "neutral200",
|
|
2474
|
+
background: "neutral0",
|
|
2475
|
+
height: "100%",
|
|
2476
|
+
"data-risk-database": id,
|
|
2477
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 3, height: "100%", children: [
|
|
2478
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "flex-start", gap: 2, wrap: "wrap", children: [
|
|
2479
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", textColor: "neutral800", tag: "h3", children: title }),
|
|
2480
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...BADGE_COLOURS[state], children: stateLabels[state] })
|
|
2481
|
+
] }),
|
|
2482
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral600", tag: "p", children: description }),
|
|
2483
|
+
state === "unusable" ? /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral800", tag: "p", children: t(
|
|
2484
|
+
"settings.config.risk.database.unusableHint",
|
|
2485
|
+
"The file exists but is not this MaxMind database. Download it again."
|
|
2486
|
+
) }) : null,
|
|
2487
|
+
built ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t("settings.config.risk.database.built", "Built {date}", { date: built }) }) : null,
|
|
2488
|
+
entry?.fromEnvironment ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t(
|
|
2489
|
+
"settings.config.risk.database.fromEnvironment",
|
|
2490
|
+
"Read from the path in an environment variable. Update that file outside Strapi."
|
|
2491
|
+
) }) : null,
|
|
2492
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: "auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2493
|
+
designSystem.Button,
|
|
2494
|
+
{
|
|
2495
|
+
ref: buttonRef,
|
|
2496
|
+
variant: "secondary",
|
|
2497
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
|
|
2498
|
+
loading: pending,
|
|
2499
|
+
disabled,
|
|
2500
|
+
onClick: download,
|
|
2501
|
+
children: state === "missing" ? t("settings.config.risk.database.download", "Download {name}", { name: shortName }) : t("settings.config.risk.database.update", "Update {name}", { name: shortName })
|
|
2502
|
+
}
|
|
2503
|
+
) })
|
|
2504
|
+
] })
|
|
2505
|
+
}
|
|
2506
|
+
);
|
|
2507
|
+
};
|
|
2508
|
+
const RiskDataCard = ({ form }) => {
|
|
2509
|
+
const { t } = useSettingsTranslate();
|
|
2510
|
+
const { settings, geoIp } = form;
|
|
2511
|
+
const lookupOff = !settings.enableGeolocation;
|
|
2512
|
+
const risk = riskData.getRiskAvailability(geoIp.status);
|
|
2513
|
+
const sourceLabels = {
|
|
2514
|
+
"anonymous-ip": t("settings.config.risk.source.anonymousIp", "Anonymous IP database"),
|
|
2515
|
+
"asn-heuristic": t("settings.config.risk.source.asn", "ASN heuristic")
|
|
2516
|
+
};
|
|
2517
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2518
|
+
SectionCard.SectionCard,
|
|
2519
|
+
{
|
|
2520
|
+
id: "risk-data",
|
|
2521
|
+
title: t("settings.config.risk.title", "Risk data (VPN, proxy, Tor)"),
|
|
2522
|
+
subtitle: t(
|
|
2523
|
+
"settings.config.risk.intro",
|
|
2524
|
+
"Location data cannot tell VPNs, proxies or Tor apart. A local MaxMind database can; lookups stay on this server."
|
|
2525
|
+
),
|
|
2526
|
+
action: risk.state === "unknown" ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2527
|
+
designSystem.Badge,
|
|
2528
|
+
{
|
|
2529
|
+
backgroundColor: risk.state === "available" ? "success100" : "neutral150",
|
|
2530
|
+
textColor: risk.state === "available" ? "success700" : "neutral700",
|
|
2531
|
+
children: risk.state === "available" ? sourceLabels[risk.source] : t("settings.config.risk.source.none", "Not set up")
|
|
2532
|
+
}
|
|
2533
|
+
),
|
|
2534
|
+
children: [
|
|
2535
|
+
lookupOff ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.geolocation", "Requires IP location lookup") }) : null,
|
|
2536
|
+
/* @__PURE__ */ jsxRuntime.jsxs(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 4, children: [
|
|
2537
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2538
|
+
RiskDatabase,
|
|
2539
|
+
{
|
|
2540
|
+
id: "anonymous-ip",
|
|
2541
|
+
title: t("settings.config.risk.anonymousIp.title", "GeoIP2 Anonymous IP"),
|
|
2542
|
+
shortName: t("settings.config.risk.anonymousIp.short", "Anonymous IP"),
|
|
2543
|
+
description: t(
|
|
2544
|
+
"settings.config.risk.anonymousIp.hint",
|
|
2545
|
+
"Paid MaxMind database. Detects VPNs, public and residential proxies, Tor exit nodes and hosting providers. The download fails if your MaxMind account does not include it."
|
|
2546
|
+
),
|
|
2547
|
+
entry: geoIp.status?.risk?.anonymousIp,
|
|
2548
|
+
form,
|
|
2549
|
+
lookupOff
|
|
2550
|
+
}
|
|
2551
|
+
),
|
|
2552
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2553
|
+
RiskDatabase,
|
|
2554
|
+
{
|
|
2555
|
+
id: "asn",
|
|
2556
|
+
title: t("settings.config.risk.asn.title", "GeoLite2 ASN (heuristic)"),
|
|
2557
|
+
shortName: t("settings.config.risk.asn.short", "ASN"),
|
|
2558
|
+
description: t(
|
|
2559
|
+
"settings.config.risk.asn.hint",
|
|
2560
|
+
"Free MaxMind database. Flags sign-ins from large hosting and cloud networks such as AWS, Azure or Hetzner for alerts. A heuristic: it does not detect VPNs, proxies or Tor and never refuses a sign-in. Used only without the Anonymous IP database."
|
|
2561
|
+
),
|
|
2562
|
+
entry: geoIp.status?.risk?.asn,
|
|
2563
|
+
form,
|
|
2564
|
+
lookupOff
|
|
2565
|
+
}
|
|
2566
|
+
)
|
|
2567
|
+
] }),
|
|
2568
|
+
geoIp.status && !geoIp.status.hasCredentials ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t(
|
|
2569
|
+
"settings.config.risk.credentials",
|
|
2570
|
+
"Downloads use the MaxMind credentials under Provider and database. Add them first."
|
|
2571
|
+
) }) : null
|
|
2572
|
+
]
|
|
2573
|
+
}
|
|
2574
|
+
);
|
|
2575
|
+
};
|
|
2369
2576
|
const LocationDataTab = ({ form }) => {
|
|
2370
2577
|
const { t } = useSettingsTranslate();
|
|
2371
2578
|
const { settings, handleChange } = form;
|
|
2579
|
+
const risk = riskData.getRiskAvailability(form.geoIp.status);
|
|
2580
|
+
const scoring = riskData.riskDependentControl(settings.enableSecurityScoring, risk.state);
|
|
2372
2581
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
2373
2582
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
2374
2583
|
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
@@ -2405,16 +2614,17 @@ const LocationDataTab = ({ form }) => {
|
|
|
2405
2614
|
title: t("settings.config.lookup.scoring.label", "Security scoring"),
|
|
2406
2615
|
description: t(
|
|
2407
2616
|
"settings.config.lookup.scoring.hint",
|
|
2408
|
-
"Applies the score thresholds: below 70 triggers a suspicious-sign-in email, below 50 a rejection if enabled.
|
|
2617
|
+
"Applies the score thresholds: below 70 triggers a suspicious-sign-in email, below 50 a rejection if enabled."
|
|
2409
2618
|
),
|
|
2410
|
-
checked:
|
|
2411
|
-
disabled: !settings.enableGeolocation,
|
|
2619
|
+
checked: scoring.checked,
|
|
2620
|
+
disabled: !settings.enableGeolocation || scoring.disabled,
|
|
2412
2621
|
onChange: (checked) => handleChange("enableSecurityScoring", checked),
|
|
2413
|
-
children: !settings.enableGeolocation ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.geolocation", "Requires IP location lookup") }) : null
|
|
2622
|
+
children: !settings.enableGeolocation ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.geolocation", "Requires IP location lookup") }) : scoring.disabled ? /* @__PURE__ */ jsxRuntime.jsx(RiskSourceNotice, { savedOn: scoring.savedOnButInactive, tab: null }) : null
|
|
2414
2623
|
}
|
|
2415
2624
|
)
|
|
2416
2625
|
] }),
|
|
2417
|
-
/* @__PURE__ */ jsxRuntime.jsx(GeoIpDatabaseCard, { form })
|
|
2626
|
+
/* @__PURE__ */ jsxRuntime.jsx(GeoIpDatabaseCard, { form }),
|
|
2627
|
+
/* @__PURE__ */ jsxRuntime.jsx(RiskDataCard, { form })
|
|
2418
2628
|
] });
|
|
2419
2629
|
};
|
|
2420
2630
|
const CodeTextarea = styled__default.default(designSystem.Textarea)`
|
|
@@ -2803,14 +3013,16 @@ const AlertsTab = ({ form }) => {
|
|
|
2803
3013
|
const emailTypesDisabled = lookupOff || !settings.enableEmailAlerts;
|
|
2804
3014
|
const webhookFieldsDisabled = lookupOff || !settings.enableWebhooks;
|
|
2805
3015
|
const templateErrors = fieldHasError(errors, "emailTemplates");
|
|
3016
|
+
const risk = riskData.getRiskAvailability(form.geoIp.status);
|
|
2806
3017
|
const emailTypes = [
|
|
2807
3018
|
{
|
|
2808
3019
|
field: "alertOnSuspiciousLogin",
|
|
3020
|
+
needsRiskData: true,
|
|
2809
3021
|
hintId: hintIds.suspicious,
|
|
2810
3022
|
label: t("settings.config.email.suspicious.label", "Suspicious sign-in"),
|
|
2811
3023
|
hint: t(
|
|
2812
3024
|
"settings.config.email.suspicious.hint",
|
|
2813
|
-
"VPN, proxy or
|
|
3025
|
+
"VPN, proxy, Tor or hosting address, or a score below 70 with scoring on."
|
|
2814
3026
|
)
|
|
2815
3027
|
},
|
|
2816
3028
|
{
|
|
@@ -2824,11 +3036,12 @@ const AlertsTab = ({ form }) => {
|
|
|
2824
3036
|
},
|
|
2825
3037
|
{
|
|
2826
3038
|
field: "alertOnVpnProxy",
|
|
3039
|
+
needsRiskData: true,
|
|
2827
3040
|
hintId: hintIds.vpnProxy,
|
|
2828
3041
|
label: t("settings.config.email.vpnProxy.label", "VPN or proxy"),
|
|
2829
3042
|
hint: t(
|
|
2830
3043
|
"settings.config.email.vpnProxy.hint",
|
|
2831
|
-
"
|
|
3044
|
+
"Sign-in from a VPN, or from a public or residential proxy."
|
|
2832
3045
|
)
|
|
2833
3046
|
}
|
|
2834
3047
|
];
|
|
@@ -2867,19 +3080,24 @@ const AlertsTab = ({ form }) => {
|
|
|
2867
3080
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 3, children: [
|
|
2868
3081
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", tag: "div", textColor: "neutral800", children: t("settings.config.email.types.label", "Send an email for") }),
|
|
2869
3082
|
!lookupOff && !settings.enableEmailAlerts ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.emailAlerts", "Requires Send security emails") }) : null,
|
|
2870
|
-
/* @__PURE__ */ jsxRuntime.jsx(EmailTypeGrid, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: emailTypes.map(({ field, hintId, label, hint }) =>
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
3083
|
+
/* @__PURE__ */ jsxRuntime.jsx(EmailTypeGrid, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: emailTypes.map(({ field, needsRiskData, hintId, label, hint }) => {
|
|
3084
|
+
const control = needsRiskData ? riskData.riskDependentControl(settings[field], risk.state) : { checked: settings[field], disabled: false, savedOnButInactive: false };
|
|
3085
|
+
const disabled = emailTypesDisabled || control.disabled;
|
|
3086
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AlertTypeCell, { checked: control.checked, disabled, children: [
|
|
3087
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3088
|
+
designSystem.Checkbox,
|
|
3089
|
+
{
|
|
3090
|
+
checked: control.checked,
|
|
3091
|
+
disabled,
|
|
3092
|
+
"aria-describedby": hintId,
|
|
3093
|
+
onCheckedChange: (checked) => handleChange(field, checked === true),
|
|
3094
|
+
children: label
|
|
3095
|
+
}
|
|
3096
|
+
),
|
|
3097
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { id: hintId, variant: "pi", textColor: "neutral600", tag: "p", children: hint }),
|
|
3098
|
+
!lookupOff && control.disabled ? /* @__PURE__ */ jsxRuntime.jsx(RiskSourceNotice, { savedOn: control.savedOnButInactive }) : null
|
|
3099
|
+
] }, field);
|
|
3100
|
+
}) }) })
|
|
2883
3101
|
] }),
|
|
2884
3102
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2885
3103
|
AdvancedSection,
|
|
@@ -2924,6 +3142,11 @@ const AlertsTab = ({ form }) => {
|
|
|
2924
3142
|
}
|
|
2925
3143
|
),
|
|
2926
3144
|
!lookupOff && !settings.enableWebhooks ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.webhooks", "Requires Send team notifications") }) : null,
|
|
3145
|
+
!lookupOff && risk.state === "missing" ? /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral600", tag: "p", "data-risk-webhook-note": "", children: t(
|
|
3146
|
+
"settings.config.webhooks.noRiskData",
|
|
3147
|
+
"Without a risk data source, {suspicious} is never sent.",
|
|
3148
|
+
WEBHOOK_EVENTS
|
|
3149
|
+
) }) : null,
|
|
2927
3150
|
/* @__PURE__ */ jsxRuntime.jsxs(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: [
|
|
2928
3151
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2929
3152
|
FormField,
|
|
@@ -3063,6 +3286,111 @@ const DataRetentionTab = ({ form }) => {
|
|
|
3063
3286
|
)
|
|
3064
3287
|
] });
|
|
3065
3288
|
};
|
|
3289
|
+
const AdminActivityTab = ({ form }) => {
|
|
3290
|
+
const { t } = useSettingsTranslate();
|
|
3291
|
+
const units = useOptionLabels();
|
|
3292
|
+
const { settings, handleChange } = form;
|
|
3293
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
3294
|
+
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
3295
|
+
"settings.config.adminActivity.intro",
|
|
3296
|
+
"The security log records sign-ins and work in this admin panel. Each admin’s history is under Session Manager > Admin panel; only admins with “View admin activity” can open it."
|
|
3297
|
+
) }),
|
|
3298
|
+
/* @__PURE__ */ jsxRuntime.jsxs(SectionCard.SectionCard, { title: t("settings.config.adminActivity.recording.title", "What is recorded"), children: [
|
|
3299
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3300
|
+
SettingsToggleRow,
|
|
3301
|
+
{
|
|
3302
|
+
id: "admin-sign-in-history",
|
|
3303
|
+
title: t("settings.config.adminActivity.signIns.label", "Record admin sign-ins"),
|
|
3304
|
+
description: t(
|
|
3305
|
+
"settings.config.adminActivity.signIns.hint",
|
|
3306
|
+
"Every sign-in, failed attempt, lockout and sign-out, and who signed out whom, with time, browser and operating system."
|
|
3307
|
+
),
|
|
3308
|
+
checked: settings.adminSignInHistory,
|
|
3309
|
+
onChange: (checked) => handleChange("adminSignInHistory", checked)
|
|
3310
|
+
}
|
|
3311
|
+
),
|
|
3312
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3313
|
+
SettingsToggleRow,
|
|
3314
|
+
{
|
|
3315
|
+
id: "admin-content-activity",
|
|
3316
|
+
title: t(
|
|
3317
|
+
"settings.config.adminActivity.content.label",
|
|
3318
|
+
"Record Content Manager activity"
|
|
3319
|
+
),
|
|
3320
|
+
description: t(
|
|
3321
|
+
"settings.config.adminActivity.content.hint",
|
|
3322
|
+
"Which entries each admin opens, creates, edits, publishes, unpublishes or deletes, with content type, title, locale and time."
|
|
3323
|
+
),
|
|
3324
|
+
checked: settings.adminContentActivity,
|
|
3325
|
+
onChange: (checked) => handleChange("adminContentActivity", checked),
|
|
3326
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral700", tag: "p", "data-privacy-note": "", children: t(
|
|
3327
|
+
"settings.config.adminActivity.content.notice",
|
|
3328
|
+
"This records how people work. In many countries employees must be told first, and in Germany the works council usually has a say. Check this before you turn it on."
|
|
3329
|
+
) })
|
|
3330
|
+
}
|
|
3331
|
+
)
|
|
3332
|
+
] }),
|
|
3333
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3334
|
+
SectionCard.SectionCard,
|
|
3335
|
+
{
|
|
3336
|
+
title: t("settings.config.adminActivity.privacy.title", "IP addresses and retention"),
|
|
3337
|
+
subtitle: t(
|
|
3338
|
+
"settings.config.adminActivity.privacy.subtitle",
|
|
3339
|
+
"These options apply to every event in the security log."
|
|
3340
|
+
),
|
|
3341
|
+
children: [
|
|
3342
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3343
|
+
SettingsToggleRow,
|
|
3344
|
+
{
|
|
3345
|
+
id: "security-log-store-ip",
|
|
3346
|
+
title: t("settings.config.adminActivity.storeIp.label", "Store IP addresses"),
|
|
3347
|
+
description: t(
|
|
3348
|
+
"settings.config.adminActivity.storeIp.hint",
|
|
3349
|
+
"The address comes from Strapi’s client IP (server.proxy settings). The location uses the IP location lookup under Location data."
|
|
3350
|
+
),
|
|
3351
|
+
checked: settings.securityLogStoreIp,
|
|
3352
|
+
onChange: (checked) => handleChange("securityLogStoreIp", checked)
|
|
3353
|
+
}
|
|
3354
|
+
),
|
|
3355
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3356
|
+
SettingsToggleRow,
|
|
3357
|
+
{
|
|
3358
|
+
id: "security-log-anonymize-ip",
|
|
3359
|
+
title: t(
|
|
3360
|
+
"settings.config.adminActivity.anonymize.label",
|
|
3361
|
+
"Anonymise the last part of IP addresses"
|
|
3362
|
+
),
|
|
3363
|
+
description: t(
|
|
3364
|
+
"settings.config.adminActivity.anonymize.hint",
|
|
3365
|
+
"Stores 203.0.113.0 instead of 203.0.113.42 (IPv6: the first 48 bits only)."
|
|
3366
|
+
),
|
|
3367
|
+
checked: settings.securityLogAnonymizeIp,
|
|
3368
|
+
disabled: !settings.securityLogStoreIp,
|
|
3369
|
+
onChange: (checked) => handleChange("securityLogAnonymizeIp", checked),
|
|
3370
|
+
children: !settings.securityLogStoreIp ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.adminActivity.requiresIp", "Requires Store IP addresses") }) : null
|
|
3371
|
+
}
|
|
3372
|
+
),
|
|
3373
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3374
|
+
PresetSelect,
|
|
3375
|
+
{
|
|
3376
|
+
id: "security-log-retention",
|
|
3377
|
+
name: "securityLogRetentionDays",
|
|
3378
|
+
label: t("settings.config.adminActivity.retention.label", "Keep security events for"),
|
|
3379
|
+
description: t(
|
|
3380
|
+
"settings.config.adminActivity.retention.hint",
|
|
3381
|
+
"Older events are deleted once a day. Events of a deleted admin are deleted with the account."
|
|
3382
|
+
),
|
|
3383
|
+
value: settings.securityLogRetentionDays,
|
|
3384
|
+
presets: SELECT_PRESETS.securityLogRetentionDays,
|
|
3385
|
+
format: units.days,
|
|
3386
|
+
onChange: (value) => handleChange("securityLogRetentionDays", value)
|
|
3387
|
+
}
|
|
3388
|
+
) })
|
|
3389
|
+
]
|
|
3390
|
+
}
|
|
3391
|
+
)
|
|
3392
|
+
] });
|
|
3393
|
+
};
|
|
3066
3394
|
async function copyText(value, clipboard = globalThis.navigator?.clipboard) {
|
|
3067
3395
|
if (typeof value !== "string") {
|
|
3068
3396
|
throw new TypeError("clipboard_value_must_be_text");
|
|
@@ -3100,6 +3428,7 @@ function useSettingsForm() {
|
|
|
3100
3428
|
const [geoIpStatusError, setGeoIpStatusError] = react.useState(false);
|
|
3101
3429
|
const [geoIpCredentials, setGeoIpCredentials] = react.useState({ accountId: "", licenseKey: "" });
|
|
3102
3430
|
const [geoIpUpdating, setGeoIpUpdating] = react.useState(false);
|
|
3431
|
+
const [riskUpdating, setRiskUpdating] = react.useState(null);
|
|
3103
3432
|
const [geoIpSavingCredentials, setGeoIpSavingCredentials] = react.useState(false);
|
|
3104
3433
|
const [settings, setSettings] = react.useState(INITIAL_SETTINGS);
|
|
3105
3434
|
const [savedSettings, setSavedSettings] = react.useState(settings);
|
|
@@ -3318,17 +3647,20 @@ function useSettingsForm() {
|
|
|
3318
3647
|
}
|
|
3319
3648
|
}, [put, t, toggleNotification, fetchGeoIpStatus]);
|
|
3320
3649
|
const handleUpdateGeoIpDatabase = react.useCallback(
|
|
3321
|
-
async (force = false) => {
|
|
3322
|
-
setGeoIpUpdating
|
|
3650
|
+
async (force = false, database = "location") => {
|
|
3651
|
+
const setPending = database === "location" ? setGeoIpUpdating : setRiskUpdating;
|
|
3652
|
+
setPending(database === "location" ? true : database);
|
|
3323
3653
|
try {
|
|
3324
|
-
const
|
|
3654
|
+
const body = database === "location" ? { force } : { force, database };
|
|
3655
|
+
const response = await post(`/${index.pluginId}/geoip/update`, body);
|
|
3325
3656
|
index.requireSuccessfulMutation(response.data);
|
|
3326
3657
|
const status = await fetchGeoIpStatus();
|
|
3327
3658
|
const result = response.data.result || {};
|
|
3659
|
+
const riskEntry = database === "anonymous-ip" ? status?.risk?.anonymousIp : database === "asn" ? status?.risk?.asn : null;
|
|
3328
3660
|
const values = {
|
|
3329
|
-
edition: status?.editionId || "—",
|
|
3661
|
+
edition: (riskEntry || status)?.editionId || "—",
|
|
3330
3662
|
date: index.formatSessionDate(
|
|
3331
|
-
result.lastModified || status?.metadata?.lastModified,
|
|
3663
|
+
result.lastModified || (riskEntry || status)?.metadata?.lastModified,
|
|
3332
3664
|
locale,
|
|
3333
3665
|
"—",
|
|
3334
3666
|
BUILD_DATE_OPTIONS
|
|
@@ -3356,7 +3688,7 @@ function useSettingsForm() {
|
|
|
3356
3688
|
)
|
|
3357
3689
|
});
|
|
3358
3690
|
} finally {
|
|
3359
|
-
|
|
3691
|
+
setPending(database === "location" ? false : null);
|
|
3360
3692
|
}
|
|
3361
3693
|
},
|
|
3362
3694
|
[post, t, locale, toggleNotification, fetchGeoIpStatus]
|
|
@@ -3388,6 +3720,7 @@ function useSettingsForm() {
|
|
|
3388
3720
|
credentials: geoIpCredentials,
|
|
3389
3721
|
setCredentials: setGeoIpCredentials,
|
|
3390
3722
|
updating: geoIpUpdating,
|
|
3723
|
+
riskUpdating,
|
|
3391
3724
|
savingCredentials: geoIpSavingCredentials,
|
|
3392
3725
|
fetchStatus: fetchGeoIpStatus,
|
|
3393
3726
|
saveCredentials: handleSaveGeoIpCredentials,
|
|
@@ -3430,7 +3763,8 @@ const TAB_COMPONENTS = {
|
|
|
3430
3763
|
"login-protection": LoginProtectionTab,
|
|
3431
3764
|
"location-data": LocationDataTab,
|
|
3432
3765
|
alerts: AlertsTab,
|
|
3433
|
-
"data-retention": DataRetentionTab
|
|
3766
|
+
"data-retention": DataRetentionTab,
|
|
3767
|
+
"admin-activity": AdminActivityTab
|
|
3434
3768
|
};
|
|
3435
3769
|
const DraftSync = ({ values }) => {
|
|
3436
3770
|
const setValues = StrapiAdmin.useForm("DraftSync", (state) => state.setValues);
|
|
@@ -3450,7 +3784,14 @@ const SettingsPage = () => {
|
|
|
3450
3784
|
const { t } = useSettingsTranslate();
|
|
3451
3785
|
const form = useSettingsForm();
|
|
3452
3786
|
const [{ query }] = StrapiAdmin.useQueryParams();
|
|
3453
|
-
const
|
|
3787
|
+
const {
|
|
3788
|
+
allowedActions: { canRead: canViewAdminActivity }
|
|
3789
|
+
} = StrapiAdmin.useRBAC(index.pluginPermissions.adminActivityRead);
|
|
3790
|
+
const visibleTabs = react.useMemo(
|
|
3791
|
+
() => getVisibleSettingsTabs(Boolean(canViewAdminActivity)),
|
|
3792
|
+
[canViewAdminActivity]
|
|
3793
|
+
);
|
|
3794
|
+
const requestedTab = resolveSettingsTab(query?.tab, visibleTabs);
|
|
3454
3795
|
const [activeTab, setActiveTab] = react.useState(requestedTab);
|
|
3455
3796
|
const [followedTab, setFollowedTab] = react.useState(requestedTab);
|
|
3456
3797
|
const tabsRef = react.useRef(null);
|
|
@@ -3477,11 +3818,14 @@ const SettingsPage = () => {
|
|
|
3477
3818
|
const handleSaveClick = react.useCallback(async () => {
|
|
3478
3819
|
if (await handleSave()) focusActiveTab();
|
|
3479
3820
|
}, [handleSave, focusActiveTab]);
|
|
3480
|
-
const changeTab = react.useCallback(
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3821
|
+
const changeTab = react.useCallback(
|
|
3822
|
+
(tab) => {
|
|
3823
|
+
const next = resolveSettingsTab(tab, visibleTabs);
|
|
3824
|
+
setActiveTab(next);
|
|
3825
|
+
writeTabToAddressBar(next);
|
|
3826
|
+
},
|
|
3827
|
+
[visibleTabs]
|
|
3828
|
+
);
|
|
3485
3829
|
const navigation = react.useMemo(
|
|
3486
3830
|
() => ({
|
|
3487
3831
|
selectTab: (tab) => {
|
|
@@ -3566,10 +3910,10 @@ const SettingsPage = () => {
|
|
|
3566
3910
|
SettingsTabsList,
|
|
3567
3911
|
{
|
|
3568
3912
|
"aria-label": t("settings.config.tabs.label", "Configuration sections"),
|
|
3569
|
-
children:
|
|
3913
|
+
children: visibleTabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(SettingsTabTrigger, { value: tab, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsTabLabel, { children: t(SETTINGS_TAB_LABELS[tab][0], SETTINGS_TAB_LABELS[tab][1]) }) }, tab))
|
|
3570
3914
|
}
|
|
3571
3915
|
),
|
|
3572
|
-
|
|
3916
|
+
visibleTabs.map((tab) => {
|
|
3573
3917
|
const TabPanel = TAB_COMPONENTS[tab];
|
|
3574
3918
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: tab, forceMount: true, hidden: activeTab !== tab, children: /* @__PURE__ */ jsxRuntime.jsx(TabPanelFrame, { "data-settings-tab-panel": "", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", paddingTop: 6, children: /* @__PURE__ */ jsxRuntime.jsx(TabPanel, { form }) }) }) }, tab);
|
|
3575
3919
|
}),
|