Website: Update partners form, update action input validation (#43954)
Changes: - Updated the input validation and added an invalidEmailDomain exit to the deliver-deal-registration-submission and deliver-partner-registration-submission actions - Updated the input validation in the deliver-whitepaper-download-request and deliver-webinar-access-request actions - Added error messages to the forms on the partners page for the added exits - Updated the `bannedEmailDomainsForCSRSigning` and `bannedEmailDomainsForWebsiteSubmissions` config values <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Blocked submissions from restricted email domains with a clear error response and a prompt to use a work email. * **Bug Fixes** * Strengthened email-format and required-field validation across registration and request forms. * Restricted partner registration type options to accepted values. * **Chores** * Added a domain to the denylist used for website submissions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -10,13 +10,13 @@ module.exports = {
|
||||
inputs: {
|
||||
submittersFirstName: {type: 'string', required: true},
|
||||
submittersLastName: {type: 'string', required: true},
|
||||
submittersEmailAddress: {type: 'string', isEmail: true,},
|
||||
submittersEmailAddress: {type: 'string', isEmail: true, required: true},
|
||||
submittersOrganization: {type: 'string', required: true},
|
||||
submitterIsExistingPartner: {type: 'string', required: true},
|
||||
|
||||
customersOrganization: {type: 'string', required: true},
|
||||
customersName: {type: 'string', required: true},
|
||||
customersEmailAddress: {type: 'string', isEmail: true,},
|
||||
customersEmailAddress: {type: 'string', isEmail: true, required: true},
|
||||
|
||||
dealStage: {type: 'string', required: true},
|
||||
expectedClose: {type: 'string', required: true},
|
||||
@@ -30,14 +30,21 @@ module.exports = {
|
||||
|
||||
exits: {
|
||||
success: {description: 'A deal registration email was successfully sent.'},
|
||||
invalidEmailDomain: {
|
||||
description: 'This email address is on a denylist of domains and was not delivered.',
|
||||
responseType: 'badRequest'
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
fn: async function (inputs) {
|
||||
let emailDomain = inputs.submittersEmailAddress.split('@')[1];
|
||||
if(_.includes(sails.config.custom.bannedEmailDomainsForWebsiteSubmissions, emailDomain.toLowerCase())){
|
||||
throw 'invalidEmailDomain';
|
||||
}
|
||||
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.');
|
||||
}
|
||||
|
||||
let emailTemplateData = _.omit(inputs, ['platforms', 'useCase']);
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ module.exports = {
|
||||
submittersLastName: { type: 'string', required: true },
|
||||
submittersEmailAddress: { type: 'string', required: true, isEmail: true },
|
||||
submittersOrganization: { type: 'string', required: true },
|
||||
partnerType: { type: 'string', required: true },
|
||||
partnerType: { type: 'string', required: true, isIn: ['reseller', 'integrations'] },
|
||||
partnerWebsite: { type: 'string', required: true },
|
||||
partnerCountry: { type: 'string', required: true },
|
||||
notes: {type: 'string', required: true },
|
||||
@@ -26,10 +26,18 @@ module.exports = {
|
||||
exits: {
|
||||
success: {description: 'A partner registration email was successfully sent.'},
|
||||
missingInput: {description: 'The form submission is missing a required input', responseType: 'badRequest'},
|
||||
invalidEmailDomain: {
|
||||
description: 'This email address is on a denylist of domains and was not delivered.',
|
||||
responseType: 'badRequest'
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
fn: async function (inputs) {
|
||||
let emailDomain = inputs.submittersEmailAddress.split('@')[1];
|
||||
if(_.includes(sails.config.custom.bannedEmailDomainsForWebsiteSubmissions, emailDomain.toLowerCase())){
|
||||
throw 'invalidEmailDomain';
|
||||
}
|
||||
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.');
|
||||
}
|
||||
@@ -53,6 +61,7 @@ module.exports = {
|
||||
'integrations': 'Build integrations with Fleet'
|
||||
};
|
||||
emailTemplateData.goal = partnerTypeFriendlyNameValuesByFormValue[inputs.partnerType];
|
||||
|
||||
// Default to sending these to the configured fromEmailAddress
|
||||
let toEmail = sails.config.custom.fromEmailAddress;
|
||||
if(inputs.partnerType === 'reseller') {
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports = {
|
||||
inputs: {
|
||||
firstName: {type: 'string', required: true },
|
||||
lastName: {type: 'string', required: true },
|
||||
emailAddress: {type: 'string', required: true },
|
||||
emailAddress: {type: 'string', required: true, isEmail: true, },
|
||||
webinarName: {type: 'string', required: true },
|
||||
},
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports = {
|
||||
inputs: {
|
||||
firstName: {type: 'string', required: true },
|
||||
lastName: {type: 'string', required: true },
|
||||
emailAddress: {type: 'string', required: true },
|
||||
emailAddress: {type: 'string', required: true, isEmail: true },
|
||||
whitepaperName: {type: 'string', required: true },
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user