mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
* 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
66 lines
1.6 KiB
JavaScript
Vendored
66 lines
1.6 KiB
JavaScript
Vendored
module.exports = {
|
|
|
|
|
|
friendlyName: 'Send password recovery email',
|
|
|
|
|
|
description: 'Send a password recovery notification to the user with the specified email address.',
|
|
|
|
|
|
inputs: {
|
|
|
|
emailAddress: {
|
|
description: 'The email address of the alleged user who wants to recover their password.',
|
|
example: '[email protected]',
|
|
type: 'string',
|
|
required: true
|
|
}
|
|
|
|
},
|
|
|
|
|
|
exits: {
|
|
|
|
success: {
|
|
description: 'The email address might have matched a user in the database. (If so, a recovery email was sent.)'
|
|
},
|
|
|
|
},
|
|
|
|
|
|
fn: async function ({emailAddress}) {
|
|
|
|
// Find the record for this user.
|
|
// (Even if no such user exists, pretend it worked to discourage sniffing.)
|
|
var userRecord = await User.findOne({ emailAddress });
|
|
if (!userRecord) {
|
|
return;
|
|
}//•
|
|
|
|
// Come up with a pseudorandom, probabilistically-unique token for use
|
|
// in our password recovery email.
|
|
var token = await sails.helpers.strings.random('url-friendly');
|
|
|
|
// Store the token on the user record
|
|
// (This allows us to look up the user when the link from the email is clicked.)
|
|
await User.updateOne({ id: userRecord.id })
|
|
.set({
|
|
passwordResetToken: token,
|
|
passwordResetTokenExpiresAt: Date.now() + sails.config.custom.passwordResetTokenTTL,
|
|
});
|
|
|
|
// Send recovery email
|
|
await sails.helpers.sendTemplateEmail.with({
|
|
to: emailAddress,
|
|
subject: 'Password reset instructions',
|
|
template: 'email-reset-password',
|
|
templateData: {
|
|
firstName: userRecord.firstName,
|
|
token: token
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
};
|