This commit is contained in:
parent
7ddf0ad1a5
commit
06ed466953
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue