mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Website: Add redirect for users with a Fleet Premium subscription. (#18374)
Closes: #18373 Changes: - Updated `view-start` to redirect users who have already purchased a license to their customer dashboard
This commit is contained in:
parent
1d34d027e3
commit
bbc4fd0ebf
1 changed files with 9 additions and 1 deletions
10
website/api/controllers/view-start.js
vendored
10
website/api/controllers/view-start.js
vendored
|
|
@ -11,12 +11,20 @@ module.exports = {
|
||||||
|
|
||||||
success: {
|
success: {
|
||||||
viewTemplatePath: 'pages/start'
|
viewTemplatePath: 'pages/start'
|
||||||
|
},
|
||||||
|
redirect: {
|
||||||
|
description: 'The requesting user already has a Fleet Premium subscription.',
|
||||||
|
responseType: 'redirect',
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
fn: async function () {
|
fn: async function () {
|
||||||
|
// If the user has a license key, we'll redirect them to the customer dashboard.
|
||||||
|
let userHasExistingSubscription = await Subscription.findOne({user: this.req.me.id});
|
||||||
|
if (userHasExistingSubscription) {
|
||||||
|
throw {redirect: '/customers/dashboard'};
|
||||||
|
}
|
||||||
if(this.req.me.lastSubmittedGetStartedQuestionnaireStep && !_.isEmpty(this.req.me.getStartedQuestionnaireAnswers)){
|
if(this.req.me.lastSubmittedGetStartedQuestionnaireStep && !_.isEmpty(this.req.me.getStartedQuestionnaireAnswers)){
|
||||||
let currentStep = this.req.me.lastSubmittedGetStartedQuestionnaireStep;
|
let currentStep = this.req.me.lastSubmittedGetStartedQuestionnaireStep;
|
||||||
let previouslyAnsweredQuestions = this.req.me.getStartedQuestionnaireAnswers;
|
let previouslyAnsweredQuestions = this.req.me.getStartedQuestionnaireAnswers;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue