pasar de status 1 a status 2 listo

This commit is contained in:
2020-11-22 20:36:55 -06:00
parent dd1d6f779e
commit 788ac0aab9
6 changed files with 388 additions and 3 deletions
+12 -1
View File
@@ -20,4 +20,15 @@ const encriptar = (password) => {
return bcrypt.hashSync(password, Number(process.env.SALT_ROUNDS));
};
module.exports = { comparar, encriptar };
const generarPassword = () => {
let length = 8;
let charset =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
let password = '';
for (let i = 0, n = charset.length; i < length; ++i)
password += charset.charAt(Math.floor(Math.random() * n));
return password;
};
module.exports = { comparar, encriptar, generarPassword };