mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-28 08:14:25 +02:00
(Guillermo) code review changes
This commit is contained in:
parent
811f4dc272
commit
70b42ed39d
@ -1,13 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
use RedBeanPHP\Facade as RedBean;
|
use RedBeanPHP\Facade as RedBean;
|
||||||
|
|
||||||
|
use Respect\Validation\Validator as DataValidator;
|
||||||
|
|
||||||
class SignUpController extends Controller {
|
class SignUpController extends Controller {
|
||||||
const PATH = '/signup';
|
const PATH = '/signup';
|
||||||
|
|
||||||
public function validations() {
|
public function validations() {
|
||||||
return [
|
return [
|
||||||
'permission' => 'any',
|
'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
|
||||||
|
]
|
||||||
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,10 @@ class ERRORS {
|
|||||||
const INVALID_CREDENTIALS = 'User or password is not defined';
|
const INVALID_CREDENTIALS = 'User or password is not defined';
|
||||||
const SESSION_EXISTS = 'User is already logged in';
|
const SESSION_EXISTS = 'User is already logged in';
|
||||||
const NO_PERMISSION = 'You have no permission to access';
|
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_TITLE = 'Invalid title';
|
||||||
const INVALID_CONTENT = 'Invalid content';
|
const INVALID_CONTENT = 'Invalid content';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user