aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/config.ts
blob: 1481e66cc66a8fc251c1bc8954a09488f289d11d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
}