From 45f1bd72a08998c60a9dd68ff069cea9de39161c Mon Sep 17 00:00:00 2001 From: John Livingston <38844060+JohnXLivingston@users.noreply.github.com> Date: Mon, 17 Feb 2020 10:16:52 +0100 Subject: Creating a user with an empty password will send an email to let him set his password (#2479) * Creating a user with an empty password will send an email to let him set his password * Consideration of Chocobozzz's comments * Tips for optional password * API documentation * Fix circular imports * Tests --- server/middlewares/validators/users.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'server/middlewares') diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index 5d52b5804..adc67a046 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts @@ -14,6 +14,7 @@ import { isUserDisplayNameValid, isUserNSFWPolicyValid, isUserPasswordValid, + isUserPasswordValidOrEmpty, isUserRoleValid, isUserUsernameValid, isUserVideoLanguages, @@ -39,7 +40,7 @@ import { Hooks } from '@server/lib/plugins/hooks' const usersAddValidator = [ body('username').custom(isUserUsernameValid).withMessage('Should have a valid username (lowercase alphanumeric characters)'), - body('password').custom(isUserPasswordValid).withMessage('Should have a valid password'), + body('password').custom(isUserPasswordValidOrEmpty).withMessage('Should have a valid password'), body('email').isEmail().withMessage('Should have a valid email'), body('videoQuota').custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'), body('videoQuotaDaily').custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily user quota'), -- cgit v1.2.3