Loopback <model>.verify is not a function\n
<p>So, I read the documentation about manage the users. I also comes from this example: <a href="https://github.com/strongloop/loopback-example-user-management" rel="nofollow">link</a>.</p>

<p>Then I try to make a model, called user-basic which bases on built-in model User. Here's the user-basic.json:</p>

<pre><code>{
  "name": "user-basic", 
  "base": "User",
  "idInjection": true, 
  "properties": {},
  "validations": [],
  "relations": {},
  "acls": [
    {
      "principalType": "ROLE",
      "principalId": "$everyone",
      "accessType": "READ",
      "permission": "ALLOW"
    }
  ],
  "methods": {}
}
</code></pre>

<p>Here's the user-basic.js</p>

<pre><code>var config = require('../../server/config.json');
var path = require('path');


module.exports = function(UserBasic) {
          UserBasic.afterRemote('create', function(ctx, member, next) {
            console.log('&gt; user.afterRemote triggered');
            var options = {
              type: 'email',
              to: UserBasic.email,
              from: 'noreply@loopback.com',
              subject: 'Thanks for registering.',
              template: path.resolve(__dirname, '../../server/views/verify.ejs'),
              redirect: '/verified',
              user: UserBasic
            };
            UserBasic.verify(options, function(err) {
              console.log('aaaaa', member.location, err);
              if (err) {
                next(err);
              } else {
                next();
              }
            });

          });

          //send password reset link when requested
          UserBasic.on('resetPasswordRequest', function(info) {
            var url = 'http://' + config.host + ':' + config.port + '/reset-password';
            var html = 'Click &lt;a href="' + url + '?access_token=' +
              info.accessToken.id + '"&gt;here&lt;/a&gt; to reset your password';

            UserBasic.app.models.Email.send({
              to: info.email,
              from: info.email,
              subject: 'Password reset',
              html: html
            }, function(err) {
              if (err) return console.log('&gt; error sending password reset email');
              console.log('&gt; sending password reset email to:', info.email);
            });
          });
        };
</code></pre>

<p>Here is my datasource:</p>

<pre><code>"emailDs": {
    "name": "emailDs",
    "connector": "mail",
    "transports": [
      {
        "type": "smtp",
        "host": "smtp.gmail.com",
        "secure": true,
        "port": 465,
        "tls": {
          "rejectUnauthorized": false
        },
        "auth": {
          "user": "aaa@gmail.com",
          "pass": "aaa"
        }
      }
    ]
  }
</code></pre>

<p>And this is my model-config:</p>

<pre><code>"user-basic": {
    "dataSource": "cloudant-pop",
    "public": true,
    "options": {
      "emailVerificationRequired": true
    }
  }
</code></pre>

<p>I ran the server and try POST a new user via <a href="http://0.0.0.0:3008/explorer" rel="nofollow">http://0.0.0.0:3008/explorer</a>. It gives me an error:</p>

<pre><code>{
  "error": {
    "name": "TypeError",
    "status": 500,
    "message": "UserBasic.verify is not a function",
    "stack": "TypeError: UserBasic.verify is not a function\n    at /Users/yogieputra/Desktop/backend_powercube/common/models/user-basic.js:23:23\n    at Function.&lt;anonymous&gt; (/Users/yogieputra/Desktop/backend_powercube/node_modules/loopback/lib/model.js:207:11)\n    at execStack (/Users/yogieputra/Desktop/backend_powercube/node_modules/strong-remoting/lib/remote-objects.js:480:26)\n    at RemoteObjects.execHooks (/Users/yogieputra/Desktop/backend_powercube/node_modules/strong-remoting/lib/remote-objects.js:492:10)\n    at phaseAfterInvoke (/Users/yogieputra/Desktop/backend_powercube/node_modules/strong-remoting/lib/remote-objects.js:652:10)\n    at runHandler (/Users/yogieputra/Desktop/backend_powercube/node_modules/loopback-phase/lib/phase.js:130:5)\n    at iterate (/Users/yogieputra/Desktop/backend_powercube/node_modules/loopback-phase/node_modules/async/lib/async.js:146:13)\n    at Object.async.eachSeries (/Users/yogieputra/Desktop/backend_powercube/node_modules/loopback-phase/node_modules/async/lib/async.js:162:9)\n    at runHandlers (/Users/yogieputra/Desktop/backend_powercube/node_modules/loopback-phase/lib/phase.js:139:13)\n    at iterate (/Users/yogieputra/Desktop/backend_powercube/node_modules/loopback-phase/node_modules/async/lib/async.js:146:13)"
  }
}
</code></pre>

<p>When I check the Database, I got the user data that I've been POST recently. Can you guys tell me what I've been missing?
Please help</p>