aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/middlewares/config.ts
blob: 1481e66cc66a8fc251c1bc8954a09488f289d11d (plain) (tree)



















                                                                                                                  
import 'express-validator'
import * as express from 'express'

import { CONFIG } from '../initializers'

function ensureUserRegistrationEnabled (req: express.Request, res: express.Response, next: express.NextFunction) {
  const registrationEnabled = CONFIG.SIGNUP.ENABLED

  if (registrationEnabled === true) {
    return next()
  }

  return res.status(400).send('User registration is not enabled.')
}

// ---------------------------------------------------------------------------

export {
  ensureUserRegistrationEnabled
}