diff --git a/src/users.js b/src/users.js index 5e0eefd2b..a0e3f85a7 100644 --- a/src/users.js +++ b/src/users.js @@ -4,6 +4,7 @@ import BoxError from './boxerror.js'; import crypto from 'node:crypto'; import constants from './constants.js'; import dashboard from './dashboard.js'; +import branding from './branding.js'; import database from './database.js'; import debugModule from 'debug'; import eventlog from './eventlog.js'; @@ -921,8 +922,8 @@ async function setTwoFactorAuthenticationSecret(user, auditSource) { if (user.twoFactorAuthenticationEnabled) throw new BoxError(BoxError.ALREADY_EXISTS, '2FA is already enabled'); - const { fqdn:dashboardFqdn } = await dashboard.getLocation(); - const secret = speakeasy.generateSecret({ name: `Cloudron ${dashboardFqdn} (${user.username})` }); + const cloudronName = await branding.getCloudronName(); + const secret = speakeasy.generateSecret({ name: `${cloudronName}` }); await update(user, { twoFactorAuthenticationSecret: secret.base32, twoFactorAuthenticationEnabled: false }, auditSource);