fleet/website/api/controllers/deliver-deal-registration-submission.js
Eric d43e71160a
Website: update emailAddress input validation (#33602)
Closes: #33548

Changes:
- Added `isEmail` validation to emailAddress inputs. The updated
endpoints will now return 400 responses if a user bypasses the frontend
validation.
2025-09-29 17:26:37 -05:00

51 lines
1.6 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'Deliver deal registration submission',
description: 'Sends an email with the contents of a deal registration form submission',
inputs: {
submittersFirstName: {type: 'string'},
submittersLastName: {type: 'string'},
submittersEmailAddress: {type: 'string', isEmail: true,},
submittersOrganization: {type: 'string'},
customersFirstName: {type: 'string'},
customersLastName: {type: 'string'},
customersEmailAddress: {type: 'string', isEmail: true,},
linkedinUrl: {type: 'string', defaultsTo: 'N/A'},
customersOrganization: {type: 'string'},
customersCurrentMdm: {type: 'string', defaultsTo: 'N/A'},
otherMdmEvaluated: {type: 'string', defaultsTo: 'N/A'},
preferredHosting: {type: 'string', defaultsTo: 'N/A'},
expectedDealSize: {type: 'string'},
expectedCloseDate: {type: 'string'},
notes: {type: 'string', defaultsTo: 'N/A'},
},
exits: {
},
fn: async function (inputs) {
if(!sails.config.custom.dealRegistrationContactEmailAddress){
throw new Error('Missing config variable! Please set sails.config.custom.dealRegistrationContactEmailAddress to be the email address of the person who receives deal registration submissions.');
}
// send the information to the deal registration contact email address.
await sails.helpers.sendTemplateEmail.with({
to: sails.config.custom.dealRegistrationContactEmailAddress,
subject: 'New deal registration form submission',
template: 'email-deal-registration',
templateData: inputs,
});
// All done.
return;
}
};