diff --git a/website/api/controllers/deliver-deal-registration-submission.js b/website/api/controllers/deliver-deal-registration-submission.js index cecde214df..e85a9b86d2 100644 --- a/website/api/controllers/deliver-deal-registration-submission.js +++ b/website/api/controllers/deliver-deal-registration-submission.js @@ -29,7 +29,7 @@ module.exports = { exits: { - + success: {description: 'A deal registration email was successfully sent.'}, }, @@ -38,11 +38,10 @@ module.exports = { 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']); - // Format the submitted platforms and useCase values into strings. + // Format the submitted platforms and useCase values into strings. let platformFriendlyNamesByPlatformValues = { apple: 'Apple (macOS, iOS/iPadOS)', windows: 'Windows', diff --git a/website/api/controllers/deliver-partner-registration-submission.js b/website/api/controllers/deliver-partner-registration-submission.js index 427d19321e..00c33d0205 100644 --- a/website/api/controllers/deliver-partner-registration-submission.js +++ b/website/api/controllers/deliver-partner-registration-submission.js @@ -10,7 +10,7 @@ module.exports = { inputs: { submittersFirstName: { type: 'string', required: true }, submittersLastName: { type: 'string', required: true }, - submittersEmailAddress: { type: 'string', required: true }, + submittersEmailAddress: { type: 'string', required: true, isEmail: true }, submittersOrganization: { type: 'string', required: true }, partnerType: { type: 'string', required: true }, partnerWebsite: { type: 'string', required: true }, @@ -24,7 +24,7 @@ module.exports = { exits: { - success: {description: 'A parter registration email was successfully sent.'}, + success: {description: 'A partner registration email was successfully sent.'}, missingInput: {description: 'The form submission is missing a required input', responseType: 'badRequest'}, }, @@ -33,9 +33,10 @@ module.exports = { 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.'); } + if(inputs.partnerType === 'reseller') { if(!inputs.numberOfHosts) { - throw 'missingInput';// This should never happen because of frontend form validation. + throw 'missingInput'; } if(!inputs.servicesOffered){ throw 'missingInput'; @@ -52,6 +53,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') { @@ -64,17 +66,16 @@ module.exports = { }; let servicesOfferedAsAFormattedString = ''; - // let formattedUseCaseString = ''; for(let key of _.keysIn(inputs.servicesOffered)){ if(inputs.servicesOffered[key] === true){ servicesOfferedAsAFormattedString += `
${servicesFriendlyNamesByFormValues[key]}`; } } emailTemplateData.servicesOffered = servicesOfferedAsAFormattedString; + // For new resellers registering, send the information to the deal registration contact email address. toEmail = sails.config.custom.dealRegistrationContactEmailAddress; } - // send the information to the deal registration contact email address. await sails.helpers.sendTemplateEmail.with({ to: toEmail, subject: 'New parter registration form submission', diff --git a/website/assets/js/pages/partners.page.js b/website/assets/js/pages/partners.page.js index f183942b07..a9a985ccdd 100644 --- a/website/assets/js/pages/partners.page.js +++ b/website/assets/js/pages/partners.page.js @@ -3,6 +3,7 @@ parasails.registerPage('partners', { // ║║║║║ ║ ║╠═╣║ ╚═╗ ║ ╠═╣ ║ ║╣ // ╩╝╚╝╩ ╩ ╩╩ ╩╩═╝ ╚═╝ ╩ ╩ ╩ ╩ ╚═╝ data: { + // Used to adjust the logo carousel animation for safari users. isSafariThirteen: bowser.safari && _.startsWith(bowser.version, '13'), isIosThirteen: bowser.safari && _.startsWith(bowser.version, '13') && bowser.ios, @@ -17,17 +18,15 @@ parasails.registerPage('partners', { partnerFormRules: { submittersFirstName: { required: true }, submittersLastName: { required: true }, - submittersEmailAddress: { required: true }, + submittersEmailAddress: { required: true, isEmail: true }, submittersOrganization: { required: true }, partnerType: { required: true }, partnerWebsite: { required: true }, partnerCountry: { required: true }, notes: {required: true }, - // IF partnerType === reseller + // Note: because these values are required based on which partnerType is selected, these values are checked by the form's handleSubmitting function. // servicesOffered: {required: true,}, // numberOfHosts: { required: true }, - - // IF partnerType === integrations // servicesCategory: { required: true }, }, @@ -50,13 +49,13 @@ parasails.registerPage('partners', { numberOfHosts: { required: true }, platforms: { required: true, - custom: (platforms)=>{ + custom: (platforms)=>{// custom validation checks that there is at least one value selected return _.keysIn(platforms).length > 0 && _.contains(_.values(platforms), true); } }, useCase: { required: true, - custom: (useCase)=>{ + custom: (useCase)=>{// custom validation checks that there is at least one value selected return _.keysIn(useCase).length > 0 && _.contains(_.values(useCase), true); } }, @@ -78,7 +77,7 @@ parasails.registerPage('partners', { //… }, mounted: async function() { - if(window.location.hash){ + if(window.location.hash){// Open the deal registration modal if this user was redirected from /deals. if(window.location.hash === '#deals') { this.modal = 'deal-registration'; } @@ -92,10 +91,12 @@ parasails.registerPage('partners', { clickOpenModal: function(modalName) { this.modal = modalName; }, + clickOpenPartnerModal: function(partnerType) { this.partnerFormData.partnerType = partnerType; this.modal = 'partner'; }, + clickSelectCustomCheckbox: async function() { await this.forceRender(); }, @@ -116,7 +117,6 @@ parasails.registerPage('partners', { this.formErrors = {}; }, - handleSubmittingPartnerForm: async function(argins) { this.syncing = true; // check to make sure that we have the required values depending on selected partnerType value. diff --git a/website/views/pages/partners.ejs b/website/views/pages/partners.ejs index dce3ffd7cc..f153f6a829 100644 --- a/website/views/pages/partners.ejs +++ b/website/views/pages/partners.ejs @@ -315,12 +315,12 @@
- +
This doesn’t appear to be a valid email address
- +
Please enter the name of your organization.