fleet/website/api/controllers/deliver-mdm-demo-email.js
Eric 7942b9008b
Website: Add MDM demo video modal to /device-management (#12380)
Changes:
- Added a modal to the /device-management page where users can fill out
a form to see an MDM demo video.
- Added a new email template: `email-mdm-video`, that is sent to users
who submit the form on the device management page.
- Added a new action: `deliver-mdm-demo-email.js`, that sends an MDM
demo video email.
- Updated the modal component to allow the default styling to be
overridden on a page-by-page basis (Moved inline styles into the
component's stylesheet)
- Updated `website/config/routes.js`, `website/config/policies.js`, and
ran the `rebuild-cloud-sdk` script.
2023-06-16 15:08:24 -05:00

47 lines
1.2 KiB
JavaScript
Vendored
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module.exports = {
friendlyName: 'Deliver MDM demo video email',
description: 'Sends an email address containing a link to a MDM demo video to the specified email address',
extendedDescription: 'This action is triggered by form submissions on the /device-management page',
inputs: {
emailAddress: {
description: 'The email address provided when this user requested access to the MDM demo video',
type: 'string',
required: true,
},
},
exits: {
success: {
description: 'An MDM demo video email was successfully sent'
}
},
fn: async function ({emailAddress}) {
// Send an email to the provided email address that contains a link to Dave's MDM demo.
await sails.helpers.sendTemplateEmail.with({
to: emailAddress,
subject: 'Daves MDM video (again)',
from: sails.config.custom.fromEmailAddress,
fromName: sails.config.custom.fromName,
template: 'email-mdm-video',
templateData: {}
}).intercept((err)=>{
return new Error(`When trying to send a MDM demo video email for a user with the email address ${emailAddress}, an error occured. full error: ${err.stack}`);
});
// All done.
return;
}
};