add subfolder to 2fa domain name #5238

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2024-01-14 21:23:49 +00:00
parent 9986567cf0
commit 6cacec010b
1 changed files with 5 additions and 1 deletions

View File

@ -3544,7 +3544,11 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
const secret = otplib.authenticator.generateSecret(); // TODO: Check the random source of this value.
var domainName = parent.certificates.CommonName;
if (domain.dns != null) { domainName = domain.dns; }
if (domain.dns != null) {
domainName = domain.dns;
} else if (domain.dns == null && domain.id != '') {
domainName += "/" + domain.id;
}
ws.send(JSON.stringify({ action: 'otpauth-request', secret: secret, url: otplib.authenticator.keyuri(encodeURIComponent(user.name), domainName, secret) }));
}
break;