{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback/issues/1796","repository_url":"https://api.github.com/repos/strongloop/loopback","labels_url":"https://api.github.com/repos/strongloop/loopback/issues/1796/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback/issues/1796/comments","events_url":"https://api.github.com/repos/strongloop/loopback/issues/1796/events","html_url":"https://github.com/strongloop/loopback/issues/1796","id":114806304,"number":1796,"title":"Why LoopbackJS doesn't set values for emailVerified and verificationToken?","user":{"login":"wzup","id":3880497,"avatar_url":"https://avatars.githubusercontent.com/u/3880497?v=3","gravatar_id":"","url":"https://api.github.com/users/wzup","html_url":"https://github.com/wzup","followers_url":"https://api.github.com/users/wzup/followers","following_url":"https://api.github.com/users/wzup/following{/other_user}","gists_url":"https://api.github.com/users/wzup/gists{/gist_id}","starred_url":"https://api.github.com/users/wzup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wzup/subscriptions","organizations_url":"https://api.github.com/users/wzup/orgs","repos_url":"https://api.github.com/users/wzup/repos","events_url":"https://api.github.com/users/wzup/events{/privacy}","received_events_url":"https://api.github.com/users/wzup/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/strongloop/loopback/labels/%23tob","name":"#tob","color":"eeeeee"},{"url":"https://api.github.com/repos/strongloop/loopback/labels/beginner-friendly","name":"beginner-friendly","color":"00dd00"},{"url":"https://api.github.com/repos/strongloop/loopback/labels/doc","name":"doc","color":"bfe5bf"}],"state":"closed","locked":false,"assignee":{"login":"loay","id":1986928,"avatar_url":"https://avatars.githubusercontent.com/u/1986928?v=3","gravatar_id":"","url":"https://api.github.com/users/loay","html_url":"https://github.com/loay","followers_url":"https://api.github.com/users/loay/followers","following_url":"https://api.github.com/users/loay/following{/other_user}","gists_url":"https://api.github.com/users/loay/gists{/gist_id}","starred_url":"https://api.github.com/users/loay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loay/subscriptions","organizations_url":"https://api.github.com/users/loay/orgs","repos_url":"https://api.github.com/users/loay/repos","events_url":"https://api.github.com/users/loay/events{/privacy}","received_events_url":"https://api.github.com/users/loay/received_events","type":"User","site_admin":false},"assignees":[{"login":"loay","id":1986928,"avatar_url":"https://avatars.githubusercontent.com/u/1986928?v=3","gravatar_id":"","url":"https://api.github.com/users/loay","html_url":"https://github.com/loay","followers_url":"https://api.github.com/users/loay/followers","following_url":"https://api.github.com/users/loay/following{/other_user}","gists_url":"https://api.github.com/users/loay/gists{/gist_id}","starred_url":"https://api.github.com/users/loay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loay/subscriptions","organizations_url":"https://api.github.com/users/loay/orgs","repos_url":"https://api.github.com/users/loay/repos","events_url":"https://api.github.com/users/loay/events{/privacy}","received_events_url":"https://api.github.com/users/loay/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2015-11-03T12:35:34Z","updated_at":"2016-09-23T15:48:14Z","closed_at":"2016-09-23T15:48:14Z","body":"I have created a custom `Client` model whose base class is a built-in `User` model. I used command-line tool `slc loopback:model` for it. An automatically created config for the model is as follows (`common/models/client.json`):\r\n\r\n    {\r\n      \"name\": \"Client\",\r\n      \"plural\": \"Clients\",\r\n      \"base\": \"User\",\r\n      \"idInjection\": true,\r\n      \"properties\": {},\r\n      \"validations\": [],\r\n      \"relations\": {},\r\n      \"acls\": [],\r\n      \"methods\": []\r\n    }\r\n\r\nSo as I understand my custom `Client` model has all the properties and behavior of `User` model.\r\n\r\nNow I want to create some `Client` instances and insert them in MongoDB. The docs says about `POST` `/users` HTML requests for creating a new DB entry that Loopback sets some values automatically (https://docs.strongloop.com/display/public/LB/User+REST+API):\r\n\r\n> JSON object (in request body) providing User object properties:\r\n> username, password, email. **LoopBack sets values for emailVerified and\r\n> verificationToken**.\r\n\r\nBut when I run my script, niether `emailVerified`, nor `verificationToken` are set. DB is populated only with the values I pass as a `POST` body. Here is my code:\r\n\r\n    ds.automigrate(collections, function(er) {\r\n        if (er) throw er;\r\n        console.log('Looback tables [' + collections + '] created in ', ds.adapter\r\n            .name);\r\n    \r\n        server.models.Client.create([{\r\n            username: 'admin',\r\n            password: \"admin\",\r\n            email: 'admin@gmail.com',\r\n            dtCrt: new Date()\r\n        }, {\r\n            username: 'admin2',\r\n            password: \"admin2\",\r\n            email: 'admin2@gmail.com',\r\n            dtCrt: new Date()\r\n        }], function(err, newClient) {\r\n            ds.disconnect();\r\n            process.exit();\r\n        });\r\n    });\r\n\r\nAnd here is a result. No `emailVerified` and `verificationToken` values are set:\r\n\r\n    [ { username: 'admin',\r\n        password: '$2a$10$EdyVnfIATxoOzI6vUeV3POIgKGomY/gtKRXfoWcrTRWZDm0dKl41y',\r\n        email: 'admin@gmail.com',\r\n        dtCrt: Sun Nov 01 2015 20:08:23 GMT+0800,\r\n        id: 563600b85e1c289829390e48 },\r\n      { username: 'admin2',\r\n        password: '$2a$10$ya6yf7iGraPGPvhjtVunZeug1i7/aTF8aSn.mYlqF0zUNVO73DJ8e',\r\n        email: 'admin2@gmail.com',\r\n        dtCrt: Sun Nov 01 2015 20:08:23 GMT+0800,\r\n        id: 563600b85e1c289829390e49 } ]\r\n\r\nWhy? How to make Loopback set those values as its docs says?"},"comment":{"url":"https://api.github.com/repos/strongloop/loopback/issues/comments/249229020","html_url":"https://github.com/strongloop/loopback/issues/1796#issuecomment-249229020","issue_url":"https://api.github.com/repos/strongloop/loopback/issues/1796","id":249229020,"user":{"login":"loay","id":1986928,"avatar_url":"https://avatars.githubusercontent.com/u/1986928?v=3","gravatar_id":"","url":"https://api.github.com/users/loay","html_url":"https://github.com/loay","followers_url":"https://api.github.com/users/loay/followers","following_url":"https://api.github.com/users/loay/following{/other_user}","gists_url":"https://api.github.com/users/loay/gists{/gist_id}","starred_url":"https://api.github.com/users/loay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loay/subscriptions","organizations_url":"https://api.github.com/users/loay/orgs","repos_url":"https://api.github.com/users/loay/repos","events_url":"https://api.github.com/users/loay/events{/privacy}","received_events_url":"https://api.github.com/users/loay/received_events","type":"User","site_admin":false},"created_at":"2016-09-23T15:48:14Z","updated_at":"2016-09-23T15:48:14Z","body":"Also, I am assuming that this part below is already done. emailVerificationRequired needs to be set to true as per the docs here: https://docs.strongloop.com/display/public/LB/Registering+users\r\n\r\n```\r\n...\r\n\"user\": {\r\n    \"dataSource\": \"db\",\r\n    \"public\": true,\r\n    \"options\": {\r\n      \"emailVerificationRequired\": true\r\n    }\r\n...\r\n```\r\n If All that is done and the previous steps still show no data in your db file, can you please provide a sample of your repo so I can have a look. \r\n\r\nThanks. "}}
{"actor":{"display_login":"loay"}}