diff options
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r-- | server/middlewares/validators/users.ts | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index ac7435b7d..920176d07 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -1,18 +1,17 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import 'express-validator' | 2 | import 'express-validator' |
3 | import { body, param } from 'express-validator/check' | 3 | import { body, param } from 'express-validator/check' |
4 | import { isSignupAllowed, logger } from '../../helpers' | ||
5 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | ||
4 | import { | 6 | import { |
5 | isIdOrUUIDValid, | ||
6 | isSignupAllowed, | ||
7 | isUserDisplayNSFWValid, | 7 | isUserDisplayNSFWValid, |
8 | isUserPasswordValid, | 8 | isUserPasswordValid, |
9 | isUserRoleValid, | 9 | isUserRoleValid, |
10 | isUserUsernameValid, | 10 | isUserUsernameValid, |
11 | isUserVideoQuotaValid, | 11 | isUserVideoQuotaValid |
12 | logger | 12 | } from '../../helpers/custom-validators/users' |
13 | } from '../../helpers' | ||
14 | import { isVideoExist } from '../../helpers/custom-validators/videos' | 13 | import { isVideoExist } from '../../helpers/custom-validators/videos' |
15 | import { database as db } from '../../initializers/database' | 14 | import { UserModel } from '../../models/account/user' |
16 | import { areValidationErrors } from './utils' | 15 | import { areValidationErrors } from './utils' |
17 | 16 | ||
18 | const usersAddValidator = [ | 17 | const usersAddValidator = [ |
@@ -153,7 +152,7 @@ export { | |||
153 | // --------------------------------------------------------------------------- | 152 | // --------------------------------------------------------------------------- |
154 | 153 | ||
155 | async function checkUserIdExist (id: number, res: express.Response) { | 154 | async function checkUserIdExist (id: number, res: express.Response) { |
156 | const user = await db.User.loadById(id) | 155 | const user = await UserModel.loadById(id) |
157 | 156 | ||
158 | if (!user) { | 157 | if (!user) { |
159 | res.status(404) | 158 | res.status(404) |
@@ -168,7 +167,7 @@ async function checkUserIdExist (id: number, res: express.Response) { | |||
168 | } | 167 | } |
169 | 168 | ||
170 | async function checkUserNameOrEmailDoesNotAlreadyExist (username: string, email: string, res: express.Response) { | 169 | async function checkUserNameOrEmailDoesNotAlreadyExist (username: string, email: string, res: express.Response) { |
171 | const user = await db.User.loadByUsernameOrEmail(username, email) | 170 | const user = await UserModel.loadByUsernameOrEmail(username, email) |
172 | 171 | ||
173 | if (user) { | 172 | if (user) { |
174 | res.status(409) | 173 | res.status(409) |