X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fconfig.ts;h=dfa549e763dc6508a8da2527fecc1981b2e6498d;hb=4c1c17093461b58d3ee3f23f239e340d8dac1149;hp=2d1f61947036a7b095b24b11e2e4ce13b27beedc;hpb=04cda1d7a5f27429acde3ecd9c3c6e18a2b44aed;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts index 2d1f61947..dfa549e76 100644 --- a/server/middlewares/validators/config.ts +++ b/server/middlewares/validators/config.ts @@ -3,10 +3,10 @@ import { body } from 'express-validator' import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users' import { logger } from '../../helpers/logger' import { CustomConfig } from '../../../shared/models/server/custom-config.model' -import { Emailer } from '../../lib/emailer' import { areValidationErrors } from './utils' import { isThemeNameValid } from '../../helpers/custom-validators/plugins' import { isThemeRegistered } from '../../lib/plugins/theme-utils' +import { isEmailEnabled } from '@server/initializers/config' const customConfigUpdateValidator = [ body('instance.name').exists().withMessage('Should have a valid instance name'), @@ -55,7 +55,7 @@ const customConfigUpdateValidator = [ body('theme.default').custom(v => isThemeNameValid(v) && isThemeRegistered(v)).withMessage('Should have a valid theme'), - async (req: express.Request, res: express.Response, next: express.NextFunction) => { + (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking customConfigUpdateValidator parameters', { parameters: req.body }) if (areValidationErrors(req, res)) return @@ -73,7 +73,7 @@ export { } function checkInvalidConfigIfEmailDisabled (customConfig: CustomConfig, res: express.Response) { - if (Emailer.isEnabled()) return true + if (isEmailEnabled()) return true if (customConfig.signup.requiresEmailVerification === true) { res.status(400)