hotFix(sendTwoFactor): fix code digits
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2024-08-08 10:07:03 +02:00
parent 2429d213da
commit 8580fa0849
1 changed files with 3 additions and 1 deletions

View File

@ -67,7 +67,9 @@ module.exports = Self => {
if (vnUser.twoFactor === 'email') { if (vnUser.twoFactor === 'email') {
const $ = Self.app.models; const $ = Self.app.models;
const code = String(Math.floor(Math.random() * 999999)); const min = 100000;
const max = 999999;
const code = String(Math.floor(Math.random() * (max - min + 1)) + min);
const maxTTL = ((60 * 1000) * 5); // 5 min const maxTTL = ((60 * 1000) * 5); // 5 min
await $.AuthCode.upsertWithWhere({userFk: vnUser.id}, { await $.AuthCode.upsertWithWhere({userFk: vnUser.id}, {
userFk: vnUser.id, userFk: vnUser.id,