Skip to content

Commit 4a84eec

Browse files
authored
Merge pull request #959 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 6a88bfb + 20e7d12 commit 4a84eec

2 files changed

Lines changed: 42 additions & 10 deletions

File tree

src/components/CippFormPages/CippAddEditUser.jsx

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ const CippAddEditUser = (props) => {
9292
// don't trigger setValue on every keystroke
9393
const rawGivenName = watcher[0]
9494
const rawSurname = watcher[1]
95-
const [debouncedName, setDebouncedName] = useState({ givenName: rawGivenName, surname: rawSurname })
95+
const [debouncedName, setDebouncedName] = useState({
96+
givenName: rawGivenName,
97+
surname: rawSurname,
98+
})
9699
const debounceRef = useRef(null)
97100
useEffect(() => {
98101
debounceRef.current = setTimeout(() => {
@@ -124,14 +127,22 @@ const CippAddEditUser = (props) => {
124127

125128
let username = formatString
126129

127-
// Replace %FirstName[n]% patterns (extract first n characters)
130+
// Replace %FirstName[n]% patterns (extract first n characters per word)
128131
username = username.replace(/%FirstName\[(\d+)\]%/gi, (match, num) => {
129-
return firstName.substring(0, parseInt(num))
132+
const n = parseInt(num)
133+
return firstName
134+
.split(/\s+/)
135+
.map((word) => word.substring(0, n))
136+
.join('')
130137
})
131138

132-
// Replace %LastName[n]% patterns (extract first n characters)
139+
// Replace %LastName[n]% patterns (extract first n characters per word)
133140
username = username.replace(/%LastName\[(\d+)\]%/gi, (match, num) => {
134-
return lastName.substring(0, parseInt(num))
141+
const n = parseInt(num)
142+
return lastName
143+
.split(/\s+/)
144+
.map((word) => word.substring(0, n))
145+
.join('')
135146
})
136147

137148
// Replace %FirstName% and %LastName%
@@ -220,15 +231,26 @@ const CippAddEditUser = (props) => {
220231

221232
// Reset manual flags and selected template when form is reset (fields become empty)
222233
useEffect(() => {
223-
if (formType === 'add' && !watchedFields.givenName && !watchedFields.surname && !watchedFields.userTemplate) {
234+
if (
235+
formType === 'add' &&
236+
!watchedFields.givenName &&
237+
!watchedFields.surname &&
238+
!watchedFields.userTemplate
239+
) {
224240
setDisplayNameManuallySet(false)
225241
setUsernameManuallySet(false)
226242
// Only clear selected template if it's not the default template
227243
if (selectedTemplate && !selectedTemplate.defaultForTenant) {
228244
setSelectedTemplate(null)
229245
}
230246
}
231-
}, [watchedFields.givenName, watchedFields.surname, watchedFields.userTemplate, formType, selectedTemplate])
247+
}, [
248+
watchedFields.givenName,
249+
watchedFields.surname,
250+
watchedFields.userTemplate,
251+
formType,
252+
selectedTemplate,
253+
])
232254

233255
// Auto-select default template for tenant
234256
useEffect(() => {

src/data/alerts.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@
562562
"inputs": [
563563
{
564564
"inputType": "autoComplete",
565-
"inputLabel": "Threshold type absolute number or percent",
565+
"inputLabel": "Threshold type",
566566
"inputName": "ThresholdType",
567567
"creatable": false,
568568
"multiple": false,
@@ -574,23 +574,33 @@
574574
{
575575
"label": "Absolute",
576576
"value": "absolute"
577+
},
578+
{
579+
"label": "Drop (% decrease from previous score)",
580+
"value": "drop"
577581
}
578582
],
579583
"required": true
580584
},
581585
{
582586
"inputType": "number",
583-
"inputLabel": "Threshold Value (below this will trigger the alert)",
587+
"inputLabel": "Threshold Value (absolute/percent: alert when below this value, drop: alert when score decreases by this percentage)",
584588
"inputName": "InputValue",
585589
"required": true
586590
}
587591
],
588-
"description": "Monitors Secure Score and alerts when it falls below the specified threshold (absolute or percent value). Helps identify security gaps and areas for improvement."
592+
"description": "Monitors Secure Score and alerts when it falls below the specified threshold (absolute or percent value) or when it drops by a defined percentage compared to the previous score. Helps identify security gaps, regressions, and areas for improvement."
589593
},
590594
{
591595
"name": "TenantAccess",
592596
"label": "Alert on tenant accessibility issues (Graph, Exchange, GDAP roles)",
593597
"recommendedRunInterval": "1d",
594598
"description": "Proactively monitors tenant accessibility by testing Graph API connectivity, GDAP role assignments, and Exchange Online access. Alerts when tenants have lost permissions, removed GDAP consent, or are missing required roles. Helps identify tenants that need a permission refresh or offboarding."
599+
},
600+
{
601+
"name": "CheckExtension",
602+
"label": "Alert on new Check phishing extension detections",
603+
"recommendedRunInterval": "15m",
604+
"description": "Monitors for new phishing site detections reported by the Check browser extension. Alerts when a user visits a page that the extension flags as a potential credential phishing or AiTM attack. Requires the Check browser extension to be deployed to users."
595605
}
596606
]

0 commit comments

Comments
 (0)