fleet/website/api/helpers/create-license-key.js

68 lines
1 KiB
JavaScript
Raw Normal View History

Add customer portal and license dispenser to fleetdm.com (#3546) * Add images for customer portal, dashboard, and email templates * updated email layout and reset password template, new email template * update ajax-button component to have an optional spinner * updated cloud-error & stripe-card-element component styles * updates to user model, add quote and subscription * Login, signup, forgot password, update profile * link to customer portal from pricing * new-license page, bootstrap updates * create quote action, dashboard page, update routes * Add new page styles to importer, update component styles * updates to js-timestamp * update modal styles and layout * using @submitted on ajax form, controller updates * Update create-quote.js * updates to quote model, action updates, truncate license key on dashboard * update email layout, subscribe action, user model * Update importer.less * style updates, order confirmation * use correct font * style updates * create license key * new-license page changes * signup page changes * add billing format to js-timestamp component, dashboard updates, change password * swap get started link for customers * order -> subscription * Update login.ejs * Lint fixes, page updates, mobile styles * remove edit-profile route, update layout, bootstrap, forms * change customer-layout name to match other layout names, update copyright year in layouts * changes requested from code review and #3570 * submit button width, contact font-size * Update dashboard.less * Update bootstrap-overrides.less * slack logo update, login text
2022-01-05 02:02:42 +00:00
module.exports = {
friendlyName: 'Create license key',
description: '',
inputs: {
numberOfHosts: {
type: 'number',
Add customer portal and license dispenser to fleetdm.com (#3546) * Add images for customer portal, dashboard, and email templates * updated email layout and reset password template, new email template * update ajax-button component to have an optional spinner * updated cloud-error & stripe-card-element component styles * updates to user model, add quote and subscription * Login, signup, forgot password, update profile * link to customer portal from pricing * new-license page, bootstrap updates * create quote action, dashboard page, update routes * Add new page styles to importer, update component styles * updates to js-timestamp * update modal styles and layout * using @submitted on ajax form, controller updates * Update create-quote.js * updates to quote model, action updates, truncate license key on dashboard * update email layout, subscribe action, user model * Update importer.less * style updates, order confirmation * use correct font * style updates * create license key * new-license page changes * signup page changes * add billing format to js-timestamp component, dashboard updates, change password * swap get started link for customers * order -> subscription * Update login.ejs * Lint fixes, page updates, mobile styles * remove edit-profile route, update layout, bootstrap, forms * change customer-layout name to match other layout names, update copyright year in layouts * changes requested from code review and #3570 * submit button width, contact font-size * Update dashboard.less * Update bootstrap-overrides.less * slack logo update, login text
2022-01-05 02:02:42 +00:00
required: true,
},
organization: {
type: 'string',
required: true,
},
validTo: {
type: 'number',
required: true,
description: 'A JS Timestamp representing when this license will expire.'
}
},
exits: {
success: {
outputType: 'string',
},
},
fn: async function (inputs) {
let jwt = require('jsonwebtoken');
let token = jwt.sign(
{
iss: 'Fleet Device Management Inc.',
exp: inputs.validTo,
sub: inputs.organization,
devices: inputs.numberOfHosts,
note: 'Created with Fleet License key dispenser',
tier: 'premium',
},
{
key: sails.config.custom.licenseKeyGeneratorPrivateKey,
passphrase: sails.config.custom.licenseKeyGeneratorPassphrase
},
{ algorithm: 'ES256' }
);
return token;
}
};