(Guillermo) code review changes

This commit is contained in:
AntonyAntonio 2016-07-19 02:35:37 -03:00
parent 811f4dc272
commit 70b42ed39d
2 changed files with 20 additions and 1 deletions

View File

@ -1,13 +1,28 @@
<?php
use RedBeanPHP\Facade as RedBean;
use Respect\Validation\Validator as DataValidator;
class SignUpController extends Controller {
const PATH = '/signup';
public function validations() {
return [
'permission' => '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
]
]
];
}

View File

@ -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';
}