Browse Source

updated Libraries/Aauth & Aauth/ErrorsTest

v3-dev
REJack 6 years ago
parent
commit
bab8b556df
No known key found for this signature in database
GPG Key ID: 4A44B48700429F46
  1. 3
      application/Libraries/Aauth.php
  2. 26
      tests/Aauth/Libraries/Aauth/ErrorsTest.php

3
application/Libraries/Aauth.php

@ -623,6 +623,8 @@ class Aauth
return false;
}
print_r($loginAttemptModel->find());
// if ($this->config->ddos_protection && $this->config->recaptcha_active && $loginAttempts->get() > $this->config->recaptcha_login_attempts){
// $this->CI->load->helper('recaptchalib');
// $reCaptcha = new ReCaptcha( $this->config->recaptcha_secret);
@ -635,7 +637,6 @@ class Aauth
if ($this->config->loginUseUsername)
{
print_r($this->config);
if (! $identifier || strlen($password) < $this->config->passwordMin || strlen($password) > $this->config->passwordMax)
{
$this->error(lang('Aauth.loginFailedUsername'));

26
tests/Aauth/Libraries/Aauth/ErrorsTest.php

@ -88,26 +88,40 @@ class ErrorsTest extends \CIUnitTestCase
$session = $this->getInstance();
$this->library = new Aauth(NULL, $session);
$this->library->error('test message 1', true);
$this->assertEquals(['test message 1'], $session->get('errors'));
$this->assertEquals(['test message 1'], $session->getFlashdata('errors'));
$this->library->clearErrors();
$this->assertNull($session->get('errors'));
$this->assertNull($session->getFlashdata('errors'));
}
public function testErrorsFlash()
{
$session = $this->getInstance();
$this->library = new Aauth(NULL, $session);
$this->assertNull($session->get('errors'));
$this->assertNull($session->getFlashdata('errors'));
$this->library->error('test message 1', true);
$this->assertEquals(['test message 1'], $session->get('errors'));
$session->start();
$this->assertEquals(['test message 1'], $session->getFlashdata('errors'));
}
public function testErrorsFlashKeep()
{
$session = $this->getInstance();
$this->library = new Aauth(NULL, $session);
$this->assertNull($session->getFlashdata('errors'));
$this->library->error('test message 1', true);
$session->start();
$this->library->keepErrors();
$session->start();
$this->assertEquals(['test message 1'], $this->library->getErrorsArray());
}
public function testErrorsFlashArray()
{
$session = $this->getInstance();
$this->library = new Aauth(NULL, $session);
$this->assertNull($session->get('errors'));
$this->assertNull($session->getFlashdata('errors'));
$this->library->error(['test message 1','test message 2'], true);
$this->assertEquals(['test message 1','test message 2'], $session->get('errors'));
$session->start();
$this->assertEquals(['test message 1','test message 2'], $session->getFlashdata('errors'));
}
}

Loading…
Cancel
Save