Skip to content

Commit

Permalink
Website: Add primaryBuyingSituation attribute to User model. (#17638)
Browse files Browse the repository at this point in the history
Changes:
- Added a new attribute to the `User` model: `primaryBuyingSituation`
- Updated `signup.js` to set this value on new User accounts


Before this PR can be merged, we will need to:
- [ ] Add the new column to the User table in the website's database
- [ ] Set a default value for existing User records.

---------

Co-authored-by: Sam Pfluger <108141731+Sampfluger88@users.noreply.github.com>
  • Loading branch information
eashaw and Sampfluger88 authored Mar 19, 2024
1 parent 9ae36d9 commit b10d1db
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
8 changes: 4 additions & 4 deletions website/api/controllers/deliver-talk-to-us-form-submission.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ module.exports = {
required: true,
description: 'What this user will be using Fleet for',
isIn: [
'vulnerability-management',
'device-management',
'endpoint-ops-it',
'endpoint-ops-security',
'vm',
'mdm',
'eo-it',
'eo-security',
],
},

Expand Down
9 changes: 5 additions & 4 deletions website/api/controllers/entrance/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ the account verification message.)`,
description: 'What the user will be using Fleet for.',
required: true,
isIn: [
'endpoint-ops-security',
'endpoint-ops-it',
'device-management',
'vulnerability-management'
'eo-security',
'eo-it',
'mdm',
'vm'
],
}

Expand Down Expand Up @@ -153,6 +153,7 @@ the account verification message.)`,
signupReason,
password: await sails.helpers.passwords.hashPassword(password),
stripeCustomerId,
primaryBuyingSituation,
tosAcceptedByIp: this.req.ip
}, sails.config.custom.verifyEmailAddresses? {
emailProofToken: await sails.helpers.strings.random('url-friendly'),
Expand Down
12 changes: 12 additions & 0 deletions website/api/models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,18 @@ without necessarily having a billing card.`
defaultsTo: false
},

primaryBuyingSituation: {
type: 'string',
description: 'The primary buying situation the user selected when they signed up.',
extendedDescription: 'User records created before 2024-03-14 will have this attribute set to ""',
isIn: [
'eo-security',
'eo-it',
'mdm',
'vm',
]
}

// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
// ╚═╝╩ ╩╚═╝╚═╝═╩╝╚═╝
Expand Down
8 changes: 4 additions & 4 deletions website/views/pages/contact.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@
<div class="selectbox">
<select class="form-control" id="primaryBuyingSituation" name="primaryBuyingSituation" :class="[formErrors.primaryBuyingSituation ? 'is-invalid' : '']" v-model="formData.primaryBuyingSituation">
<option disabled hidden value="undefined">Choose an option</option>
<option value="endpoint-ops-security">Endpoint operations for security engineers</option>
<option value="endpoint-ops-it">Endpoint operations for IT admins</option>
<option value="device-management">Device management</option>
<option value="vulnerability-management">Vulnerability management</option>
<option value="eo-security">Endpoint operations for security engineers</option>
<option value="eo-it">Endpoint operations for IT admins</option>
<option value="mdm">Device management (MDM)</option>
<option value="vm">Vulnerability management</option>
</select>
</div>
<div class="d-block invalid-feedback" v-if="formErrors.topic">Please select an option.</div>
Expand Down
8 changes: 4 additions & 4 deletions website/views/pages/entrance/signup.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
<div class="selectbox">
<select class="form-control" id="primaryBuyingSituation" name="primaryBuyingSituation" :class="[formErrors.primaryBuyingSituation ? 'is-invalid' : '']" v-model="formData.primaryBuyingSituation" @input="typeClearOneFormError('primaryBuyingSituation')">
<option disabled hidden value="undefined">Choose an option</option>
<option value="endpoint-ops-security">Endpoint operations for security engineers</option>
<option value="endpoint-ops-it">Endpoint operations for IT admins</option>
<option value="device-management">Device management</option>
<option value="vulnerability-management">Vulnerability management</option>
<option value="eo-security">Endpoint operations for security engineers</option>
<option value="eo-it">Endpoint operations for IT admins</option>
<option value="mdm">Device management (MDM)</option>
<option value="vm">Vulnerability management</option>
</select>
</div>
<div class="d-block invalid-feedback" v-if="formErrors.primaryBuyingSituation">Please select an option.</div>
Expand Down

0 comments on commit b10d1db

Please sign in to comment.