From 8ef2c2adf77d1c256a223757acbede5e49408aa7 Mon Sep 17 00:00:00 2001 From: REJack Date: Wed, 12 Dec 2018 09:21:23 +0100 Subject: [PATCH] updated CHANGES.md, Config/Aauth, UserModelTest & UserTest --- CHANGES.md | 2 +- application/Config/Aauth.php | 5 ++--- tests/Aauth/Database/UserModelTest.php | 15 ++++++++++++++- tests/Aauth/Libraries/Aauth/UserTest.php | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f943634..eff759a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -43,7 +43,7 @@ - verification_link => linkVerification - totp_two_step_login_redirect => linkTotp - verification => userVerification - - additional_valid_chars => userAdditionalChars + - additional_valid_chars => userRegexPattern - min => passwordMin - max => passwordMax - password_hash_algo => passwordHashAlgo diff --git a/application/Config/Aauth.php b/application/Config/Aauth.php index ab6b002..3826fcb 100644 --- a/application/Config/Aauth.php +++ b/application/Config/Aauth.php @@ -70,9 +70,8 @@ class Aauth extends BaseConfig | | 'userRegexPattern' | - | Additional valid chars for username. Non alphanumeric characters that are - | allowed by default - | (default: '[a-zA-Z0-9]+') + | Regex pattern for valid chars for username + | (default: '^[a-zA-Z0-9]{3,}$') */ public $userVerification = false; public $userRegexPattern = '^[a-zA-Z0-9]{3,}$'; diff --git a/tests/Aauth/Database/UserModelTest.php b/tests/Aauth/Database/UserModelTest.php index 3e269de..110c1ce 100644 --- a/tests/Aauth/Database/UserModelTest.php +++ b/tests/Aauth/Database/UserModelTest.php @@ -95,9 +95,22 @@ class UserModelTest extends CIDatabaseTestCase public function testUpdate() { - $this->assertFalse($this->model->update(2, ['id' => 2, 'email' => 'admin@example.com'])); + $this->assertFalse($this->model->update(2, ['email' => 'admin@example.com'])); + print_r($this->model->errors()); $this->assertEquals(lang('Aauth.existsAlreadyEmail'), $this->model->errors()[0]); + // $this->assertFalse($this->model->update(2, ['email' => 'adminexample.com'])); + // $this->assertEquals(lang('Aauth.invalidEmail'), $this->model->errors()[0]); + + // $this->assertFalse($this->model->update(2, ['password' => 'pass'])); + // $this->assertEquals(lang('Aauth.invalidPassword'), $this->model->errors()[0]); + + // $this->assertFalse($this->model->update(2, ['password' => 'password12345678901011121314151617'])); + // $this->assertEquals(lang('Aauth.invalidPassword'), $this->model->errors()[0]); + + // $this->assertFalse($this->model->update(2, ['password' => 'password12345678901011121314151617'])); + // $this->assertEquals(lang('Aauth.invalidPassword'), $this->model->errors()[0]); + // $this->assertFalse($this->library->updateUser(2, 'admin@example.com', null, null)); // $this->assertEquals(lang('Aauth.existsAlreadyEmail'), $this->library->getErrorsArray()[0]); diff --git a/tests/Aauth/Libraries/Aauth/UserTest.php b/tests/Aauth/Libraries/Aauth/UserTest.php index 86169f5..46c4adf 100644 --- a/tests/Aauth/Libraries/Aauth/UserTest.php +++ b/tests/Aauth/Libraries/Aauth/UserTest.php @@ -78,7 +78,7 @@ class UserTest extends CIDatabaseTestCase ]); $this->assertEquals(lang('Aauth.infoUpdateSuccess'), $this->library->getInfosArray()[0]); - // moved to UserModelTest + // moved to UserModelTest, not working here :/ // $this->assertFalse($this->library->updateUser(2, 'admin@example.com', null, null)); // $this->assertEquals(lang('Aauth.existsAlreadyEmail'), $this->library->getErrorsArray()[0]);