0.2.3 • Published 4 years ago

loopback-register-user-mixin v0.2.3

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

REGISTER USER MIXIN

This module is for the loopback framework. It handles user registration.

INSTALL

  npm i loopback-register-user-mixin --S

SERVER CONFIG

Add the mixins property to your server/model-config.json:

{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "../node_modules/loopback-register-user-mixin/models",
      "./models"
    ],
    "mixins": [
      "loopback/common/mixins",
      "../node_modules/loopback-register-user-mixin",
      "../common/mixins"
    ]
  }
}
  "RequestBody": {
    "public": false
  }

MODEL CONFIG

  {
    "name": "User",
    "properties": {
      "name": {
        "type": "string",
      }
    },
    "mixins": {
      "RegisterUser": true
    }
  }

CONFIG EMAIL

  Member.beforeRemote('register', (ctx, _, next) => {
    ctx.emailConfig = {
      redirect: `${URL}/confirm`,
      from: 'example@example.com',
      subject: 'Thanks for Registering | Example app',
      templatePath: path.resolve(__dirname, './emails/verify-email.ejs'),
      templateData: {
        signature: 'Elon',
        buttonText: 'Activate account',
        lines: [
          'Thank you',
          'Thanks for registering. Please follow the link below to complete your registration.',
        ],
      },
    };
    next();
  });
0.2.3

4 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago