From 2781c2b2ef9796920c1344bc82edaaaaa3c4609a Mon Sep 17 00:00:00 2001 From: REJack Date: Mon, 31 Dec 2018 19:34:17 +0000 Subject: [PATCH] reverted some changes before & updated UserTest --- app/Libraries/Aauth.php | 16 ++++++++-------- tests/Aauth/Libraries/Aauth/UserTest.php | 3 +-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/Libraries/Aauth.php b/app/Libraries/Aauth.php index 00f0613..659e62c 100644 --- a/app/Libraries/Aauth.php +++ b/app/Libraries/Aauth.php @@ -176,7 +176,7 @@ class Aauth return false; } - if (! $user = $userModel->where('username', $identifier)->getFirstRow('array')) + if (! $user = $userModel->where('username', $identifier)->asArray()->first()) { $this->error(lang('Aauth.notFoundUser')); @@ -194,7 +194,7 @@ class Aauth return false; } - if (! $user = $userModel->where('email', $identifier)->getFirstRow('array')) + if (! $user = $userModel->where('email', $identifier)->asArray()->first()) { $this->error(lang('Aauth.notFoundUser')); @@ -346,15 +346,15 @@ class Aauth $userModel->where('id', $userId); $userModel->where('banned', 0); - if (! $user = $userModel->get()->getFirstRow('array')) + if (! $user = $userModel->asArray()->first()) { return false; } $this->session->set('user', [ - 'id' => $user->id, - 'username' => $user->username, - 'email' => $user->email, + 'id' => $user['id'], + 'username' => $user['username'], + 'email' => $user['email'], 'loggedIn' => true, ]); @@ -851,7 +851,7 @@ class Aauth 'system' => 1, ]; - if (! $verificationCodeStored = $userVariableModel->where($userVariable)->getFirstRow('array')) + if (! $verificationCodeStored = $userVariableModel->where($userVariable)->asArray()->first()) { $this->error(lang('Aauth.invalidVerficationCode')); @@ -927,7 +927,7 @@ class Aauth $where = ['email' => $email]; } - if (! $user = $userModel->where($where)->getFirstRow('array')) + if (! $user = $userModel->where($where)->asArray()->first()) { return false; } diff --git a/tests/Aauth/Libraries/Aauth/UserTest.php b/tests/Aauth/Libraries/Aauth/UserTest.php index 0952108..4d6c47f 100644 --- a/tests/Aauth/Libraries/Aauth/UserTest.php +++ b/tests/Aauth/Libraries/Aauth/UserTest.php @@ -232,8 +232,7 @@ class UserTest extends CIDatabaseTestCase $session->set('user', [ 'id' => 1, ]); - $userIdNone = $this->library->getUserId(); - $this->assertEquals('1', $userIdNone); + $this->assertEquals('1', $this->library->getUserId()); $this->assertFalse($this->library->getUserId('none@example.com')); }