mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-07-09 13:58:25 +02:00
remove DeviceCodeCaptured variable
Signed-off-by: Ronni Skansing <rskansing@gmail.com>
This commit is contained in:
@@ -474,23 +474,6 @@ func (t *Template) CreatePhishingPageWithCampaignAndRecipient(
|
||||
}
|
||||
(*data)["RandomRecipient"] = t.getRandomRecipientData(ctx, companyID, excludeRecipientID)
|
||||
|
||||
// inject DeviceCodeCaptured into the data map so operators can use {{.DeviceCodeCaptured}}
|
||||
// in page templates. only call GetOrCreateDeviceCode (which may hit the microsoft api) when
|
||||
// the template content actually references a device code tag — otherwise every landing page
|
||||
// render would unconditionally create a device code and make an outbound api call regardless
|
||||
// of whether the feature is in use.
|
||||
(*data)["DeviceCodeCaptured"] = false
|
||||
usesDeviceCode := strings.Contains(contentToRender, "DeviceCodeCaptured") ||
|
||||
strings.Contains(contentToRender, "MicrosoftDeviceCode")
|
||||
if usesDeviceCode && t.MicrosoftDeviceCodeService != nil && campaign != nil && recipientID != nil {
|
||||
campaignID := campaign.ID.MustGet()
|
||||
if *recipientID != uuid.Nil && campaignID != uuid.Nil {
|
||||
if entry, dcErr := t.MicrosoftDeviceCodeService.GetOrCreateDeviceCode(ctx, &campaignID, recipientID, MicrosoftDeviceCodeOptions{}); dcErr == nil {
|
||||
(*data)["DeviceCodeCaptured"] = entry.Captured
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err = tmpl.Execute(w, data)
|
||||
if err != nil {
|
||||
return w, fmt.Errorf("failed to execute page template: %s", err)
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
const deviceCodeTemplates = [
|
||||
{ label: 'User Code', text: '{{MicrosoftDeviceCode}}' },
|
||||
{ label: 'Verification URL', text: '{{MicrosoftDeviceCodeURL}}' },
|
||||
{ label: 'Captured', text: '{{.DeviceCodeCaptured}}' }
|
||||
{ label: 'Captured', text: '{{DeviceCodeCaptured}}' }
|
||||
];
|
||||
|
||||
$: computedTemplates = (() => {
|
||||
@@ -457,7 +457,7 @@
|
||||
.replaceAll('{{.URL}}', _url)
|
||||
.replaceAll('{{MicrosoftDeviceCode}}', 'ABCD-1234')
|
||||
.replaceAll('{{MicrosoftDeviceCodeURL}}', 'https://microsoft.com/devicelogin')
|
||||
.replaceAll('{{.DeviceCodeCaptured}}', 'false');
|
||||
.replaceAll('{{DeviceCodeCaptured}}', 'false');
|
||||
case 'email':
|
||||
return text
|
||||
.replaceAll('{{.FirstName}}', 'Alice')
|
||||
@@ -484,7 +484,7 @@
|
||||
.replaceAll('{{.URL}}', _url)
|
||||
.replaceAll('{{MicrosoftDeviceCode}}', 'ABCD-1234')
|
||||
.replaceAll('{{MicrosoftDeviceCodeURL}}', 'https://microsoft.com/devicelogin')
|
||||
.replaceAll('{{.DeviceCodeCaptured}}', 'false');
|
||||
.replaceAll('{{DeviceCodeCaptured}}', 'false');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user