aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/users.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-06-07 16:59:53 +0200
committerChocobozzz <me@florianbigard.com>2019-06-07 17:05:42 +0200
commit1f20622f2b087eaf8738d60fae00a44b9c558ca3 (patch)
tree1c8554623665ca96b8a1e6f2a6bcb8c1b5a83c2e /server/middlewares/validators/users.ts
parent1a03bea0c42fa1064ce4770157b4fd2e3edd5565 (diff)
downloadPeerTube-1f20622f2b087eaf8738d60fae00a44b9c558ca3.tar.gz
PeerTube-1f20622f2b087eaf8738d60fae00a44b9c558ca3.tar.zst
PeerTube-1f20622f2b087eaf8738d60fae00a44b9c558ca3.zip
Improve registration
* Add ability to set the user display name * Use display name to guess the username/channel name * Add explanations about what is the purpose of a username/channel name * Add a loader at the "done" step
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r--server/middlewares/validators/users.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts
index 7a081af33..b4e09c9b7 100644
--- a/server/middlewares/validators/users.ts
+++ b/server/middlewares/validators/users.ts
@@ -53,8 +53,16 @@ const usersRegisterValidator = [
53 body('username').custom(isUserUsernameValid).withMessage('Should have a valid username'), 53 body('username').custom(isUserUsernameValid).withMessage('Should have a valid username'),
54 body('password').custom(isUserPasswordValid).withMessage('Should have a valid password'), 54 body('password').custom(isUserPasswordValid).withMessage('Should have a valid password'),
55 body('email').isEmail().withMessage('Should have a valid email'), 55 body('email').isEmail().withMessage('Should have a valid email'),
56 body('channel.name').optional().custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'), 56 body('displayName')
57 body('channel.displayName').optional().custom(isVideoChannelNameValid).withMessage('Should have a valid display name'), 57 .optional()
58 .custom(isUserDisplayNameValid).withMessage('Should have a valid display name'),
59
60 body('channel.name')
61 .optional()
62 .custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'),
63 body('channel.displayName')
64 .optional()
65 .custom(isVideoChannelNameValid).withMessage('Should have a valid display name'),
58 66
59 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 67 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
60 logger.debug('Checking usersRegister parameters', { parameters: omit(req.body, 'password') }) 68 logger.debug('Checking usersRegister parameters', { parameters: omit(req.body, 'password') })