diff options
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/config.ts | 15 | ||||
-rw-r--r-- | server/controllers/api/users.ts | 4 |
2 files changed, 11 insertions, 8 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 3e9aa77a5..f02a2bc58 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | 2 | ||
3 | import { CONFIG } from '../../initializers' | 3 | import { isSignupAllowed } from '../../helpers' |
4 | import { ServerConfig } from '../../../shared' | 4 | import { ServerConfig } from '../../../shared' |
5 | 5 | ||
6 | const configRouter = express.Router() | 6 | const configRouter = express.Router() |
@@ -9,12 +9,15 @@ configRouter.get('/', getConfig) | |||
9 | 9 | ||
10 | // Get the client credentials for the PeerTube front end | 10 | // Get the client credentials for the PeerTube front end |
11 | function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) { | 11 | function getConfig (req: express.Request, res: express.Response, next: express.NextFunction) { |
12 | const json: ServerConfig = { | 12 | |
13 | signup: { | 13 | isSignupAllowed().then(allowed => { |
14 | enabled: CONFIG.SIGNUP.ENABLED | 14 | const json: ServerConfig = { |
15 | signup: { | ||
16 | allowed | ||
17 | } | ||
15 | } | 18 | } |
16 | } | 19 | res.json(json) |
17 | res.json(json) | 20 | }) |
18 | } | 21 | } |
19 | 22 | ||
20 | // --------------------------------------------------------------------------- | 23 | // --------------------------------------------------------------------------- |
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts index 6c375cc5b..f50dbc9a3 100644 --- a/server/controllers/api/users.ts +++ b/server/controllers/api/users.ts | |||
@@ -6,7 +6,7 @@ import { logger, getFormatedObjects } from '../../helpers' | |||
6 | import { | 6 | import { |
7 | authenticate, | 7 | authenticate, |
8 | ensureIsAdmin, | 8 | ensureIsAdmin, |
9 | ensureUserRegistrationEnabled, | 9 | ensureUserRegistrationAllowed, |
10 | usersAddValidator, | 10 | usersAddValidator, |
11 | usersUpdateValidator, | 11 | usersUpdateValidator, |
12 | usersRemoveValidator, | 12 | usersRemoveValidator, |
@@ -48,7 +48,7 @@ usersRouter.post('/', | |||
48 | ) | 48 | ) |
49 | 49 | ||
50 | usersRouter.post('/register', | 50 | usersRouter.post('/register', |
51 | ensureUserRegistrationEnabled, | 51 | ensureUserRegistrationAllowed, |
52 | usersAddValidator, | 52 | usersAddValidator, |
53 | createUser | 53 | createUser |
54 | ) | 54 | ) |