passkey: disallow in demo mode
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import assert from 'node:assert';
|
||||
import AuditSource from '../auditsource.js';
|
||||
import BoxError from '../boxerror.js';
|
||||
import constants from '../constants.js';
|
||||
import { HttpError } from '@cloudron/connect-lastmile';
|
||||
import { HttpSuccess } from '@cloudron/connect-lastmile';
|
||||
import oidcServer from '../oidcserver.js';
|
||||
@@ -248,6 +249,8 @@ async function registerPasskey(req, res, next) {
|
||||
assert.strictEqual(typeof req.user, 'object');
|
||||
assert.strictEqual(typeof req.body, 'object');
|
||||
|
||||
if (constants.DEMO && req.user.username === constants.DEMO_USERNAME) return next(new HttpError(412, 'Not allowed in demo mode'));
|
||||
|
||||
if (!req.body.credential || typeof req.body.credential !== 'object') return next(new HttpError(400, 'credential must be an object'));
|
||||
if (req.body.name && typeof req.body.name !== 'string') return next(new HttpError(400, 'name must be a string'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user