- }
- }).end()
-}
-
-async function registerUser (req: express.Request, res: express.Response) {
- const body: UserRegister = req.body
-
- const userToCreate = new UserModel({
- username: body.username,
- password: body.password,
- email: body.email,
- nsfwPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY,
- autoPlayVideo: true,
- role: UserRole.USER,
- videoQuota: CONFIG.USER.VIDEO_QUOTA,
- videoQuotaDaily: CONFIG.USER.VIDEO_QUOTA_DAILY,
- emailVerified: CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION ? false : null
- })
-
- const { user, account, videoChannel } = await createUserAccountAndChannelAndPlaylist({
- userToCreate: userToCreate,
- userDisplayName: body.displayName || undefined,
- channelNames: body.channel