From e590b4a512617bbf63595b684386f68abea7d8b8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 May 2019 10:46:32 +0200 Subject: Add ability to specify channel on registration --- server/controllers/api/users/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server/controllers') diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index 0aafba66e..a04f77841 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts @@ -46,6 +46,7 @@ import { mySubscriptionsRouter } from './my-subscriptions' import { CONFIG } from '../../../initializers/config' import { sequelizeTypescript } from '../../../initializers/database' import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' +import { UserRegister } from '../../../../shared/models/users/user-register.model' const auditLogger = auditLoggerFactory('users') @@ -197,7 +198,7 @@ async function createUser (req: express.Request, res: express.Response) { } async function registerUser (req: express.Request, res: express.Response) { - const body: UserCreate = req.body + const body: UserRegister = req.body const userToCreate = new UserModel({ username: body.username, @@ -211,7 +212,7 @@ async function registerUser (req: express.Request, res: express.Response) { emailVerified: CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION ? false : null }) - const { user } = await createUserAccountAndChannelAndPlaylist(userToCreate) + const { user } = await createUserAccountAndChannelAndPlaylist(userToCreate, body.channel) auditLogger.create(body.username, new UserAuditView(user.toFormattedJSON())) logger.info('User %s with its channel and account registered.', body.username) -- cgit v1.2.3