mirror of
https://github.com/fleetdm/fleet
synced 2026-05-10 10:40:46 +00:00
Related to: #18869 Changes: - Updated the /start questionnaire to generate a 30 day, 10 host trial for Fleet Premium when users submit the step before the "Is it any good?" step (Where the user is directed to try `fleetctl preview`) and to save the details (license key and expiration timestamp) of the trial to their user record. - Added two new attributes to the User model: - `fleetPremiumTrialLicenseKey`: A Fleet Premium license key that was generated for the user when they progressed through the get started questionnaire. - `fleetPremiumTrialLicenseKeyExpiresAt`: A JS timestamp of when the user's Fleet Premium trial license key expires. - Updated the try-fleet page to have copyable terminal commands, and to add the `--license_key` flag with the users license key to the command to run `fleetctl preview`
56 lines
1.1 KiB
JavaScript
Vendored
56 lines
1.1 KiB
JavaScript
Vendored
module.exports = {
|
|
|
|
|
|
friendlyName: 'View fleetctl preview',
|
|
|
|
|
|
description: 'Display "fleetctl preview" page.',
|
|
|
|
inputs: {
|
|
start: {
|
|
type: 'boolean',
|
|
description: 'A boolean flag that will hide the "next steps" buttons on the page if set to true',
|
|
defaultsTo: false,
|
|
}
|
|
},
|
|
|
|
exits: {
|
|
|
|
success: {
|
|
viewTemplatePath: 'pages/fleetctl-preview'
|
|
},
|
|
|
|
redirect: {
|
|
description: 'The requesting user is not logged in.',
|
|
responseType: 'redirect'
|
|
},
|
|
|
|
},
|
|
|
|
|
|
fn: async function ({start}) {
|
|
|
|
let trialLicenseKey;
|
|
// Check to see if this user has a Fleet premium trial license key.
|
|
let userHasTrialLicense = this.req.me.fleetPremiumTrialLicenseKey;
|
|
let userHasExpiredTrialLicense = false;
|
|
if(userHasTrialLicense) {
|
|
if(this.req.me.fleetPremiumTrialLicenseKeyExpiresAt < Date.now()) {
|
|
userHasExpiredTrialLicense = true;
|
|
}
|
|
trialLicenseKey = this.req.me.fleetPremiumTrialLicenseKey;
|
|
} else {
|
|
trialLicenseKey = '';
|
|
}
|
|
|
|
// Respond with view.
|
|
return {
|
|
hideNextStepsButtons: start,
|
|
trialLicenseKey,
|
|
userHasExpiredTrialLicense,
|
|
};
|
|
|
|
}
|
|
|
|
|
|
};
|