diff options
author | Chocobozzz <me@florianbigard.com> | 2019-05-28 10:46:32 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-05-28 10:46:32 +0200 |
commit | e590b4a512617bbf63595b684386f68abea7d8b8 (patch) | |
tree | e5a173ffce942787ea8285239ee235a3f3607e65 /server/controllers/api/users | |
parent | cce1b3dfd386c77a02f2b4f18f60bd916a60a2d3 (diff) | |
download | PeerTube-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.ts | 5 |
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' | |||
46 | import { CONFIG } from '../../../initializers/config' | 46 | import { CONFIG } from '../../../initializers/config' |
47 | import { sequelizeTypescript } from '../../../initializers/database' | 47 | import { sequelizeTypescript } from '../../../initializers/database' |
48 | import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' | 48 | import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' |
49 | import { UserRegister } from '../../../../shared/models/users/user-register.model' | ||
49 | 50 | ||
50 | const auditLogger = auditLoggerFactory('users') | 51 | const auditLogger = auditLoggerFactory('users') |
51 | 52 | ||
@@ -197,7 +198,7 @@ async function createUser (req: express.Request, res: express.Response) { | |||
197 | } | 198 | } |
198 | 199 | ||
199 | async function registerUser (req: express.Request, res: express.Response) { | 200 | async 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) |