WIP: #6427 - SMS Recover Password #2037

Draft
jsegarra wants to merge 77 commits from 6427_sms_resetPassword into dev
1 changed files with 2 additions and 3 deletions
Showing only changes of commit 06ed466953 - Show all commits

View File

@ -1,4 +1,5 @@
const models = require('vn-loopback/server/server').models;
const maxTTL = ((60 * 1000) * 5); // 5 min
module.exports = authCode = async(vnUser, options) => {
const myOptions = {};
@ -7,11 +8,9 @@ module.exports = authCode = async(vnUser, options) => {
Object.assign(myOptions, options);
const code = String(Math.floor(Math.random() * 999999));
console.log(code);
const maxTTL = ((60 * 1000) * 5); // 5 min
await models.AuthCode.upsertWithWhere({userFk: vnUser.id}, {
userFk: vnUser.id,
code: code,
code,
expires: Date.vnNow() + maxTTL
}, myOptions);
return code;