aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-05-28 10:46:32 +0200
committerChocobozzz <me@florianbigard.com>2019-05-28 10:46:32 +0200
commite590b4a512617bbf63595b684386f68abea7d8b8 (patch)
treee5a173ffce942787ea8285239ee235a3f3607e65 /server/controllers/api/users
parentcce1b3dfd386c77a02f2b4f18f60bd916a60a2d3 (diff)
downloadPeerTube-e590b4a512617bbf63595b684386f68abea7d8b8.tar.gz
PeerTube-e590b4a512617bbf63595b684386f68abea7d8b8.tar.zst
PeerTube-e590b4a512617bbf63595b684386f68abea7d8b8.zip
Add ability to specify channel on registration
Diffstat (limited to 'server/controllers/api/users')
-rw-r--r--server/controllers/api/users/index.ts5
1 files changed, 3 insertions, 2 deletions
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'
46import { CONFIG } from '../../../initializers/config' 46import { CONFIG } from '../../../initializers/config'
47import { sequelizeTypescript } from '../../../initializers/database' 47import { sequelizeTypescript } from '../../../initializers/database'
48import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' 48import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
49import { UserRegister } from '../../../../shared/models/users/user-register.model'
49 50
50const auditLogger = auditLoggerFactory('users') 51const auditLogger = auditLoggerFactory('users')
51 52
@@ -197,7 +198,7 @@ async function createUser (req: express.Request, res: express.Response) {
197} 198}
198 199
199async function registerUser (req: express.Request, res: express.Response) { 200async function registerUser (req: express.Request, res: express.Response) {
200 const body: UserCreate = req.body 201 const body: UserRegister = req.body
201 202
202 const userToCreate = new UserModel({ 203 const userToCreate = new UserModel({
203 username: body.username, 204 username: body.username,
@@ -211,7 +212,7 @@ async function registerUser (req: express.Request, res: express.Response) {
211 emailVerified: CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION ? false : null 212 emailVerified: CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION ? false : null
212 }) 213 })
213 214
214 const { user } = await createUserAccountAndChannelAndPlaylist(userToCreate) 215 const { user } = await createUserAccountAndChannelAndPlaylist(userToCreate, body.channel)
215 216
216 auditLogger.create(body.username, new UserAuditView(user.toFormattedJSON())) 217 auditLogger.create(body.username, new UserAuditView(user.toFormattedJSON()))
217 logger.info('User %s with its channel and account registered.', body.username) 218 logger.info('User %s with its channel and account registered.', body.username)