Commit 6414b151856f9dca43b222bdc9288d7de635143a

Authored by Alex Savenko
1 parent 2c0b6e23

email validation

Showing 1 changed file with 2 additions and 1 deletions   Show diff stats
app/library/App/Controllers/UserController.php
@@ -107,6 +107,7 @@ class UserController extends CrudResourceController @@ -107,6 +107,7 @@ class UserController extends CrudResourceController
107 107
108 protected function beforeHandleWrite() 108 protected function beforeHandleWrite()
109 { 109 {
  110 + throw new Exception('777', "test exception");
110 $email_field = 'email'; 111 $email_field = 'email';
111 112
112 $validation = new Validation(); 113 $validation = new Validation();
@@ -124,7 +125,7 @@ class UserController extends CrudResourceController @@ -124,7 +125,7 @@ class UserController extends CrudResourceController
124 125
125 if (!isset($data[$email_field])) { 126 if (!isset($data[$email_field])) {
126 127
127 - $message = $validation->validate($data['email']); 128 + $message = $validation->validate($data[$email_field]);
128 if (count($message)) { 129 if (count($message)) {
129 throw new Exception(ErrorCodes::DATA_FAILED, 'Unable to create item', [ 130 throw new Exception(ErrorCodes::DATA_FAILED, 'Unable to create item', [
130 'messages' => $message, 131 'messages' => $message,