mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
Website: requested changes from website review (#18923)
Changes: - Moved the logic for redirecting users to the license dispenser after they login/sign up into the page scripts for the login and register pages. - Updated error messages in the create lead helper
This commit is contained in:
parent
ab3f7ec08f
commit
cde4a61bd3
6 changed files with 17 additions and 30 deletions
|
|
@ -25,7 +25,7 @@ module.exports = {
|
|||
|
||||
// if the user isn't logged in, we'll redirect them to the register page.
|
||||
if (!this.req.me) {
|
||||
throw {redirect: '/register?purchaseLicense'};
|
||||
throw {redirect: '/register#purchaseLicense'};
|
||||
}
|
||||
// If the user is a super admin, we'll redirect them to the generate-license page.
|
||||
if(this.req.me.isSuperAdmin) {
|
||||
|
|
|
|||
13
website/api/controllers/entrance/view-login.js
vendored
13
website/api/controllers/entrance/view-login.js
vendored
|
|
@ -7,12 +7,7 @@ module.exports = {
|
|||
description: 'Display "Login" page.',
|
||||
|
||||
inputs: {
|
||||
purchaseLicense: {
|
||||
type: 'boolean',
|
||||
description: 'If this query string is provided, this user will be taken directly to the /new-license page after they login.',
|
||||
extendedDescription: 'This value is only present when a user navigates to this page from the /register page if they were redirected to that page from the /new-license page.',
|
||||
defaultsTo: false,
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
exits: {
|
||||
|
|
@ -29,7 +24,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
fn: async function ({purchaseLicense}) {
|
||||
fn: async function () {
|
||||
|
||||
if (this.req.me) {
|
||||
if(this.req.me.isSuperAdmin){
|
||||
|
|
@ -39,9 +34,7 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
return {
|
||||
redirectToLicenseDispenser: purchaseLicense,
|
||||
};
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
15
website/api/controllers/entrance/view-signup.js
vendored
15
website/api/controllers/entrance/view-signup.js
vendored
|
|
@ -6,14 +6,7 @@ module.exports = {
|
|||
|
||||
description: 'Display "Signup" page.',
|
||||
|
||||
inputs: {
|
||||
purchaseLicense: {
|
||||
type: 'boolean',
|
||||
description: 'If this query string is provided, this user will be taken directly to the /new-license page after they signup.',
|
||||
extendedDescription: 'This value will only be present if the user is redirected to this page from the customers/view-new-license',
|
||||
defaultsTo: false,
|
||||
}
|
||||
},
|
||||
inputs: {},
|
||||
|
||||
exits: {
|
||||
|
||||
|
|
@ -29,15 +22,13 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
fn: async function ({purchaseLicense}) {
|
||||
fn: async function () {
|
||||
|
||||
if (this.req.me) {
|
||||
throw {redirect: '/start'};
|
||||
}
|
||||
|
||||
return {
|
||||
redirectToLicenseDispenser: purchaseLicense,
|
||||
};
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ module.exports = {
|
|||
return await salesforceConnection.sobject('Contact')
|
||||
.retrieve(salesforceContactId);
|
||||
}).intercept((err)=>{
|
||||
return new Error(`When attempting to create a new Lead record using an existing Contact record (ID: ${salesforceContactId}), an error occurred when retreiving the specified record. Full error: ${err}`);
|
||||
return new Error(`When attempting to create a new Lead record using an existing Contact record (ID: ${salesforceContactId}), an error occurred when retreiving the specified record. Error: ${err}`);
|
||||
});
|
||||
|
||||
// Get the Account record.
|
||||
|
|
@ -70,7 +70,7 @@ module.exports = {
|
|||
return await salesforceConnection.sobject('Account')
|
||||
.retrieve(salesforceAccountId);
|
||||
}).intercept((err)=>{
|
||||
return new Error(`When attempting to create a Lead record using an exisitng Account record (ID: ${salesforceAccountId}), An error occured when retreiving the specified record. Full error: ${err}`);
|
||||
return new Error(`When attempting to create a Lead record using an exisitng Account record (ID: ${salesforceAccountId}), An error occured when retreiving the specified record. Error: ${err}`);
|
||||
});
|
||||
|
||||
let primaryBuyingSituationValuesByCodename = {
|
||||
|
|
@ -106,7 +106,7 @@ module.exports = {
|
|||
OwnerId: accountRecord.OwnerId
|
||||
});
|
||||
}).intercept((err)=>{
|
||||
return new Error(`Could not create new Lead record. Full error: ${err}`);
|
||||
return new Error(`Could not create new Lead record. Error: ${err}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,10 +37,12 @@ parasails.registerPage('login', {
|
|||
if(window.location.search === '?admin') {
|
||||
this.showCustomerLogin = false;
|
||||
}
|
||||
|
||||
// If we're redirecting this user to the license dispenser after they log in, modify the link to the /register page and the pageToRedirectToAfterLogin.
|
||||
if(this.redirectToLicenseDispenser){
|
||||
this.loginSlug = '/register?purchaseLicense';
|
||||
if(window.location.hash && window.location.hash === '#purchaseLicense'){
|
||||
this.registerSlug = '/register#purchaseLicense';
|
||||
this.pageToRedirectToAfterLogin = '/new-license';
|
||||
window.location.hash = '';
|
||||
}
|
||||
},
|
||||
mounted: async function() {
|
||||
|
|
|
|||
|
|
@ -34,9 +34,10 @@ parasails.registerPage('signup', {
|
|||
// ╩═╝╩╚ ╚═╝╚═╝ ╩ ╚═╝╩═╝╚═╝
|
||||
beforeMount: function() {
|
||||
// If we're redirecting this user to the license dispenser after they sign up, modify the link to the login page and the pageToRedirectToAfterRegistration
|
||||
if(this.redirectToLicenseDispenser){
|
||||
this.loginSlug = '/login?purchaseLicense';
|
||||
if(window.location.hash && window.location.hash === '#purchaseLicense'){
|
||||
this.loginSlug = '/login#purchaseLicense';
|
||||
this.pageToRedirectToAfterRegistration = '/new-license';
|
||||
window.location.hash = '';
|
||||
}
|
||||
},
|
||||
mounted: async function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue