Skip to content

Commit 09d4128

Browse files
committed
fixed auth/mysqli bugs
1 parent 83ff10c commit 09d4128

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

src/core/apiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function validate(array $rules, array $messages = []) {
5757
* @return string, $message: The to add to the errors array
5858
*/
5959
public function returnErrors() {
60-
return $this->form->returnErrors();
60+
return $this->form->errors();
6161
}
6262

6363
public function file_upload($path, $file, $file_category = "image"): Array {

src/core/auth.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,13 @@ public function connect($host, $user, $password, $dbname) {
3232
* @return array user: all user info + tokens + session data
3333
*/
3434
public function basicLogin($username, $password, $password_encode = "md5") {
35-
if ($username == null || $password == null) {
36-
$this->response->respond([
37-
"errors" => "Username and password required"
38-
]);
39-
}
4035
$this->form->validate([
4136
"username" => "validusername",
4237
"password" => "required"
4338
]);
44-
if (!empty($this->form->returnErrors())) {
39+
if (!empty($this->form->errors())) {
4540
$this->response->respond([
46-
"errors" => $this->form->returnErrors()
41+
"errors" => $this->form->errors()
4742
]);
4843
} else {
4944
if ($password_encode == "md5") {
@@ -70,9 +65,9 @@ public function basicRegister($username, $email, $password, $confirm_password, $
7065
if ($password != $confirm_password) {
7166
$this->form->errors["password"] = "Your passwords don't match";
7267
}
73-
if (!empty($this->form->returnErrors())) {
68+
if (!empty($this->form->errors())) {
7469
$this->response->respond([
75-
"errors" => $this->form->returnErrors()
70+
"errors" => $this->form->errors()
7671
]);
7772
} else {
7873
if ($password_encode == "md5") {

src/core/controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function validate(array $rules, array $messages = []) {
4949
* @return string, $message: The to add to the errors array
5050
*/
5151
public function returnErrors() {
52-
return $this->form->returnErrors();
52+
return $this->form->errors();
5353
}
5454

5555
/**

0 commit comments

Comments
 (0)