add subfolder to 2fa domain name #5238

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Jan 14, 2024 at 21:23 UTC 6cacec010b74736621c07e371251cf58f52dabe1
1 file changed +5 -1
meshuser.js
+5 -1
@@ -3544,7 +3544,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
3544 const secret = otplib.authenticator.generateSecret(); // TODO: Check the random source of this value.
3545
3546 var domainName = parent.certificates.CommonName;
3547 - if (domain.dns != null) { domainName = domain.dns; }
3547 + if (domain.dns != null) {
3548 + domainName = domain.dns;
3549 + } else if (domain.dns == null && domain.id != '') {
3550 + domainName += "/" + domain.id;
3551 + }
3552 ws.send(JSON.stringify({ action: 'otpauth-request', secret: secret, url: otplib.authenticator.keyuri(encodeURIComponent(user.name), domainName, secret) }));
3553 }
3554 break;