diff --git a/server/controllers/user/signup.php b/server/controllers/user/signup.php index 0088858a..353c5e94 100644 --- a/server/controllers/user/signup.php +++ b/server/controllers/user/signup.php @@ -1,13 +1,28 @@ 'any', - 'requestData' => [] + 'requestData' => [ + 'name' => [ + 'validation' => DataValidator::length(2, 50), + 'error' => ERRORS::INVALID_NAME + ], + 'email' => [ + 'validation' => DataValidator::contains('@'), + 'error' => ERRORS::INVALID_EMAIL + ], + 'password' => [ + 'validation' => DataValidator::length(5, 20), + 'error' => ERRORS::INVALID_PASSWORD + ] + ] ]; } diff --git a/server/models/ERRORS.php b/server/models/ERRORS.php index a8dbe39c..c6dd0e05 100644 --- a/server/models/ERRORS.php +++ b/server/models/ERRORS.php @@ -3,6 +3,10 @@ class ERRORS { const INVALID_CREDENTIALS = 'User or password is not defined'; const SESSION_EXISTS = 'User is already logged in'; const NO_PERMISSION = 'You have no permission to access'; + const INVALID_NAME = 'Invalid name'; + const INVALID_EMAIL = 'Invalid email'; + const INVALID_PASSWORD = 'Invalid password'; const INVALID_TITLE = 'Invalid title'; const INVALID_CONTENT = 'Invalid content'; + }