diff --git a/src/core/apiController.php b/src/core/apiController.php index 49a3e66..b28fedd 100644 --- a/src/core/apiController.php +++ b/src/core/apiController.php @@ -57,7 +57,7 @@ public function validate(array $rules, array $messages = []) { * @return string, $message: The to add to the errors array */ public function returnErrors() { - return $this->form->returnErrors(); + return $this->form->errors(); } public function file_upload($path, $file, $file_category = "image"): Array { diff --git a/src/core/auth.php b/src/core/auth.php index 90feb8b..2b214f9 100644 --- a/src/core/auth.php +++ b/src/core/auth.php @@ -32,18 +32,13 @@ public function connect($host, $user, $password, $dbname) { * @return array user: all user info + tokens + session data */ public function basicLogin($username, $password, $password_encode = "md5") { - if ($username == null || $password == null) { - $this->response->respond([ - "errors" => "Username and password required" - ]); - } $this->form->validate([ "username" => "validusername", "password" => "required" ]); - if (!empty($this->form->returnErrors())) { + if (!empty($this->form->errors())) { $this->response->respond([ - "errors" => $this->form->returnErrors() + "errors" => $this->form->errors() ]); } else { if ($password_encode == "md5") { @@ -70,9 +65,9 @@ public function basicRegister($username, $email, $password, $confirm_password, $ if ($password != $confirm_password) { $this->form->errors["password"] = "Your passwords don't match"; } - if (!empty($this->form->returnErrors())) { + if (!empty($this->form->errors())) { $this->response->respond([ - "errors" => $this->form->returnErrors() + "errors" => $this->form->errors() ]); } else { if ($password_encode == "md5") { diff --git a/src/core/controller.php b/src/core/controller.php index 5ec8a08..bc13970 100644 --- a/src/core/controller.php +++ b/src/core/controller.php @@ -49,7 +49,7 @@ public function validate(array $rules, array $messages = []) { * @return string, $message: The to add to the errors array */ public function returnErrors() { - return $this->form->returnErrors(); + return $this->form->errors(); } /**