@joystick.js/node

Accounts Emails

How Joystick's built-in accounts emails work.

When utilizing the accounts.recover_password() method, Joystick will attempt to use a pre-defined template (as a Joystick component) at the path email/reset_password.js.

If a template is defined, Joystick will use this instead of just printing the reset password URL to your server console.

Example Usage

At a minimum, your custom email/reset_password.js template should include a link pointing to the value of props.url:

emails/reset_password.js

import joystick from '@joystick.js/ui';

const ResetPassword = joystick.component({
  render: ({ props, state, data, each, when, methods }) => {
    return `
      <div>
        <p>A reset password request has been generated for this email (${props?.email_address}). To reset your password, click the link below. If you did not request this reset, ignore this email.</p>
        <a href="${props?.url}">Reset Password</a>
      </div>
    `;
  },
});

export default ResetPassword;