Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the form for ip optout #791

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions spire/templates/apps/dovetail-marketing-form-handler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ Resources:
const email = params.get('inputEmail');
const name = params.get('inputName') || 'Unknown';
const organization = params.get('textOrganization') || 'Unknown';
const type = params.get('messageType') || 'Unknown';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using this for both the contact and optout requests, so I introduced a type to specify that, mostly for including in the ZD ticket subject to know how to handle the request more easily

const sourceIp = event.requestContext.http.sourceIp;
const userAgent = event.requestContext.http.userAgent;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We get the IP from the form, but I want to have and use the IP from the actual request, and the user agent as well, for reviewing the request.


if (!email) {
return {
Expand All @@ -117,7 +120,7 @@ Resources:

// Concat all form fields from the request as the ticket
// comment body
let comment = '';
let comment = `sourceIp: ${sourceIp}\n\nuserAgent: ${userAgent}\n\n-----\n\n`;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding these at the top of the list of data in the ZD ticket body

for (const [key, value] of params) {
comment = comment.concat(`${key}: ${value}\n\n`);
}
Expand All @@ -129,7 +132,7 @@ Resources:
email,
name,
},
subject: `Website form submission: ${organization}`,
subject: `Website form submission: ${type} - ${organization}`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the type in here as well, so you can see immediately if this is a contact or optout message

comment: {
body: comment,
}
Expand Down