Disable ldap/directory config/2fa in demo mode

This commit is contained in:
Girish Ramakrishnan
2020-07-22 16:18:22 -07:00
parent 23c4550430
commit 4086f2671d
2 changed files with 6 additions and 0 deletions

View File

@@ -660,6 +660,8 @@ function setTwoFactorAuthenticationSecret(userId, callback) {
userdb.get(userId, function (error, result) {
if (error) return callback(error);
if (settings.isDemo() && result.username === constants.DEMO_USERNAME) return callback(new BoxError(BoxError.BAD_FIELD, 'Not allowed in demo mode'));
if (result.twoFactorAuthenticationEnabled) return callback(new BoxError(BoxError.ALREADY_EXISTS));
var secret = speakeasy.generateSecret({ name: `Cloudron ${settings.adminFqdn()} (${result.username})` });