diff options
Diffstat (limited to 'server/controllers/api/users.ts')
-rw-r--r-- | server/controllers/api/users.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts index 04d885185..1b5b7f903 100644 --- a/server/controllers/api/users.ts +++ b/server/controllers/api/users.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | 2 | ||
3 | import { database as db } from '../../initializers/database' | 3 | import { database as db } from '../../initializers/database' |
4 | import { USER_ROLES } from '../../initializers' | 4 | import { USER_ROLES, CONFIG } from '../../initializers' |
5 | import { logger, getFormattedObjects } from '../../helpers' | 5 | import { logger, getFormattedObjects } from '../../helpers' |
6 | import { | 6 | import { |
7 | authenticate, | 7 | authenticate, |
@@ -80,12 +80,18 @@ export { | |||
80 | function createUser (req: express.Request, res: express.Response, next: express.NextFunction) { | 80 | function createUser (req: express.Request, res: express.Response, next: express.NextFunction) { |
81 | const body: UserCreate = req.body | 81 | const body: UserCreate = req.body |
82 | 82 | ||
83 | // On registration, we set the user video quota | ||
84 | if (body.videoQuota === undefined) { | ||
85 | body.videoQuota = CONFIG.USER.VIDEO_QUOTA | ||
86 | } | ||
87 | |||
83 | const user = db.User.build({ | 88 | const user = db.User.build({ |
84 | username: body.username, | 89 | username: body.username, |
85 | password: body.password, | 90 | password: body.password, |
86 | email: body.email, | 91 | email: body.email, |
87 | displayNSFW: false, | 92 | displayNSFW: false, |
88 | role: USER_ROLES.USER | 93 | role: USER_ROLES.USER, |
94 | videoQuota: body.videoQuota | ||
89 | }) | 95 | }) |
90 | 96 | ||
91 | user.save() | 97 | user.save() |
@@ -140,6 +146,7 @@ function updateUser (req: express.Request, res: express.Response, next: express. | |||
140 | .then(user => { | 146 | .then(user => { |
141 | if (body.password) user.password = body.password | 147 | if (body.password) user.password = body.password |
142 | if (body.displayNSFW !== undefined) user.displayNSFW = body.displayNSFW | 148 | if (body.displayNSFW !== undefined) user.displayNSFW = body.displayNSFW |
149 | if (body.videoQuota !== undefined) user.videoQuota = body.videoQuota | ||
143 | 150 | ||
144 | return user.save() | 151 | return user.save() |
145 | }) | 152 | }) |