aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/users.ts25
1 files changed, 12 insertions, 13 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts
index c93895f2f..6b6e6c2df 100644
--- a/server/middlewares/validators/users.ts
+++ b/server/middlewares/validators/users.ts
@@ -1,8 +1,14 @@
1import * as Bluebird from 'bluebird'
2import * as express from 'express' 1import * as express from 'express'
3import { body, param, query } from 'express-validator' 2import { body, param, query } from 'express-validator'
4import { omit } from 'lodash' 3import { omit } from 'lodash'
4import { Hooks } from '@server/lib/plugins/hooks'
5import { MUserDefault } from '@server/types/models'
6import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
7import { UserRole } from '../../../shared/models/users'
8import { UserRegister } from '../../../shared/models/users/user-register.model'
9import { isActorPreferredUsernameValid } from '../../helpers/custom-validators/activitypub/actor'
5import { isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc' 10import { isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc'
11import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
6import { 12import {
7 isNoInstanceConfigWarningModal, 13 isNoInstanceConfigWarningModal,
8 isNoWelcomeModal, 14 isNoWelcomeModal,
@@ -22,22 +28,15 @@ import {
22 isUserVideoQuotaValid, 28 isUserVideoQuotaValid,
23 isUserVideosHistoryEnabledValid 29 isUserVideosHistoryEnabledValid
24} from '../../helpers/custom-validators/users' 30} from '../../helpers/custom-validators/users'
31import { isVideoChannelNameValid } from '../../helpers/custom-validators/video-channels'
25import { logger } from '../../helpers/logger' 32import { logger } from '../../helpers/logger'
33import { doesVideoExist } from '../../helpers/middlewares'
26import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' 34import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup'
35import { isThemeRegistered } from '../../lib/plugins/theme-utils'
27import { Redis } from '../../lib/redis' 36import { Redis } from '../../lib/redis'
28import { UserModel } from '../../models/account/user' 37import { UserModel } from '../../models/account/user'
29import { areValidationErrors } from './utils'
30import { ActorModel } from '../../models/activitypub/actor' 38import { ActorModel } from '../../models/activitypub/actor'
31import { isActorPreferredUsernameValid } from '../../helpers/custom-validators/activitypub/actor' 39import { areValidationErrors } from './utils'
32import { isVideoChannelNameValid } from '../../helpers/custom-validators/video-channels'
33import { UserRegister } from '../../../shared/models/users/user-register.model'
34import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
35import { isThemeRegistered } from '../../lib/plugins/theme-utils'
36import { doesVideoExist } from '../../helpers/middlewares'
37import { UserRole } from '../../../shared/models/users'
38import { MUserDefault } from '@server/types/models'
39import { Hooks } from '@server/lib/plugins/hooks'
40import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
41 40
42const usersListValidator = [ 41const usersListValidator = [
43 query('blocked') 42 query('blocked')
@@ -529,7 +528,7 @@ async function checkUserNameOrEmailDoesNotAlreadyExist (username: string, email:
529 return true 528 return true
530} 529}
531 530
532async function checkUserExist (finder: () => Bluebird<MUserDefault>, res: express.Response, abortResponse = true) { 531async function checkUserExist (finder: () => Promise<MUserDefault>, res: express.Response, abortResponse = true) {
533 const user = await finder() 532 const user = await finder()
534 533
535 if (!user) { 534 if (!user) {