mirror of
https://github.com/fleetdm/fleet
synced 2026-05-13 20:18:58 +00:00
Closes: #28364 Changes: - Updated the /try-fleet page to redirect logged-out users to the /register page - Updated the signup and login forms to redirect users to the try-fleet page (if they navigated it that page before signing up/logging in)
59 lines
1.2 KiB
JavaScript
Vendored
59 lines
1.2 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}) {
|
|
|
|
if(!this.req.me) {
|
|
throw {redirect: '/register#tryfleet'};
|
|
}
|
|
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,
|
|
};
|
|
|
|
}
|
|
|
|
|
|
};
|