diff --git a/website/api/controllers/view-start.js b/website/api/controllers/view-start.js index a18fdd8ed1..b342c01855 100644 --- a/website/api/controllers/view-start.js +++ b/website/api/controllers/view-start.js @@ -11,12 +11,20 @@ module.exports = { success: { viewTemplatePath: 'pages/start' + }, + redirect: { + description: 'The requesting user already has a Fleet Premium subscription.', + responseType: 'redirect', } - }, 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)){ let currentStep = this.req.me.lastSubmittedGetStartedQuestionnaireStep; let previouslyAnsweredQuestions = this.req.me.getStartedQuestionnaireAnswers;