Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d97b173ee7 | ||
|
|
b61152f10e |
@@ -157,16 +157,17 @@ final class CoreLibsACLLoginTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function loginProvider(): array
|
public function loginProvider(): array
|
||||||
{
|
{
|
||||||
// 0: mock settings/override flag settings
|
// 0[mock] : mock settings/override flag settings
|
||||||
// 2: get array IN
|
// 1[get] : get array IN
|
||||||
// 1: post array IN
|
// 2[post] : post array IN
|
||||||
// login_login, login_username, login_password, login_logout
|
// login_login, login_username, login_password, login_logout
|
||||||
// change_password, pw_username, pw_old_password, pw_new_password,
|
// change_password, pw_username, pw_old_password, pw_new_password,
|
||||||
// pw_new_password_confirm
|
// pw_new_password_confirm
|
||||||
// 2: override session set
|
// 3[session]: override session set
|
||||||
// 3: expected error code, 0 for all ok, 3000 for login page view
|
// 4[error] : expected error code, 0 for all ok, 3000 for login page view
|
||||||
// note that 1000 (no db), 2000 (no session) must be tested too
|
// note that 1000 (no db), 2000 (no session) must be tested too
|
||||||
// 4: expected return array, eg login_error code, or other info data to match
|
// 5[return] : expected return array, eg login_error code,
|
||||||
|
// or other info data to match
|
||||||
$tests = [
|
$tests = [
|
||||||
'load, no login' => [
|
'load, no login' => [
|
||||||
// error code, only for exceptions
|
// error code, only for exceptions
|
||||||
@@ -1546,6 +1547,14 @@ final class CoreLibsACLLoginTest extends TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if _POST login set check this is matching
|
||||||
|
if (!empty($post['login_login'])) {
|
||||||
|
$this->assertTrue(
|
||||||
|
$login_mock->loginActionRun(),
|
||||||
|
'Assert that post login_login was pressed'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// always check, even on error or not set
|
// always check, even on error or not set
|
||||||
if (!$login_mock->loginGetLoginUserIdUnclean()) {
|
if (!$login_mock->loginGetLoginUserIdUnclean()) {
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ final class CoreLibsDBExtendedArrayIOTest extends TestCase
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDBIO()
|
public function testArrayDBIO()
|
||||||
{
|
{
|
||||||
$this->assertTrue(true, 'DB Extended ArrayIO Tests not implemented');
|
// $this->assertTrue(true, 'DB Extended ArrayIO Tests not implemented');
|
||||||
$this->markTestIncomplete(
|
$this->markTestIncomplete(
|
||||||
'DB\Extended\ArrayIO Tests have not yet been implemented'
|
'DB\Extended\ArrayIO Tests have not yet been implemented'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ final class CoreLibsOutputFormElementsTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testOutputFormElements()
|
public function testOutputFormElements()
|
||||||
{
|
{
|
||||||
$this->assertTrue(true, 'Output Form Elements Tests not implemented');
|
// $this->assertTrue(true, 'Output Form Elements Tests not implemented');
|
||||||
$this->markTestIncomplete(
|
$this->markTestIncomplete(
|
||||||
'Output\Form\Elements Tests have not yet been implemented'
|
'Output\Form\Elements Tests have not yet been implemented'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ final class CoreLibsOutputFormTokenTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testOutputFormToken()
|
public function testOutputFormToken()
|
||||||
{
|
{
|
||||||
$this->assertTrue(true, 'Output Form Token Tests not implemented');
|
// $this->assertTrue(true, 'Output Form Token Tests not implemented');
|
||||||
$this->markTestIncomplete(
|
$this->markTestIncomplete(
|
||||||
'Output\Form\Token Tests have not yet been implemented'
|
'Output\Form\Token Tests have not yet been implemented'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ final class CoreLibsOutputImageTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testOutputImage()
|
public function testOutputImage()
|
||||||
{
|
{
|
||||||
$this->assertTrue(true, 'Output Image Tests not implemented');
|
// $this->assertTrue(true, 'Output Image Tests not implemented');
|
||||||
$this->markTestIncomplete(
|
$this->markTestIncomplete(
|
||||||
'Output\Image Tests have not yet been implemented'
|
'Output\Image Tests have not yet been implemented'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ final class CoreLibsOutputProgressbarTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testOutputProgressbar()
|
public function testOutputProgressbar()
|
||||||
{
|
{
|
||||||
/* $this->assertTrue(true, 'Output Progressbar Tests not implemented');
|
// $this->assertTrue(true, 'Output Progressbar Tests not implemented');
|
||||||
$this->markTestIncomplete(
|
// $this->markTestIncomplete(
|
||||||
'Output\Progressbar Tests have not yet been implemented'
|
// 'Output\Progressbar Tests have not yet been implemented'
|
||||||
); */
|
// );
|
||||||
$this->markTestSkipped('No implementation for Output\Progressbar at the moment');
|
$this->markTestSkipped('No implementation for Output\Progressbar at the moment');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ $data = [
|
|||||||
];
|
];
|
||||||
// log action
|
// log action
|
||||||
// no log if login
|
// no log if login
|
||||||
if (!$login->login) {
|
if (!$login->loginActionRun()) {
|
||||||
$cms->adbEditLog('Submit', $data, 'BINARY');
|
$cms->adbEditLog('Submit', $data, 'BINARY');
|
||||||
}
|
}
|
||||||
//------------------------------ logging end
|
//------------------------------ logging end
|
||||||
|
|||||||
@@ -79,12 +79,12 @@ class Login
|
|||||||
/** @var string source, either _GET or _POST or empty */
|
/** @var string source, either _GET or _POST or empty */
|
||||||
private $login_user_id_source = '';
|
private $login_user_id_source = '';
|
||||||
/** @var bool set to true if illegal characters where found in the login user id string */
|
/** @var bool set to true if illegal characters where found in the login user id string */
|
||||||
private $login_unclear = false;
|
private $login_user_id_unclear = false;
|
||||||
// is set to one if login okay, or EUID is set and user is okay to access this page
|
// is set to one if login okay, or EUID is set and user is okay to access this page
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
private $permission_okay = false;
|
private $permission_okay = false;
|
||||||
/** @var string pressed login */
|
/** @var string pressed login */
|
||||||
public $login;
|
private $login = '';
|
||||||
/** @var string master action command */
|
/** @var string master action command */
|
||||||
private $action;
|
private $action;
|
||||||
/** @var string login name */
|
/** @var string login name */
|
||||||
@@ -1564,7 +1564,7 @@ EOM;
|
|||||||
);
|
);
|
||||||
// flag unclean input data
|
// flag unclean input data
|
||||||
if ($login_user_id_changed > 0) {
|
if ($login_user_id_changed > 0) {
|
||||||
$this->login_unclear = true;
|
$this->login_user_id_unclear = true;
|
||||||
// error for invalid user id?
|
// error for invalid user id?
|
||||||
$this->log->debug('LOGIN USER ID', 'Invalid characters: '
|
$this->log->debug('LOGIN USER ID', 'Invalid characters: '
|
||||||
. $login_user_id_changed . ' in loginUserId: '
|
. $login_user_id_changed . ' in loginUserId: '
|
||||||
@@ -2139,6 +2139,16 @@ EOM;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if login button was pressed
|
||||||
|
*
|
||||||
|
* @return bool If login action was run, return true
|
||||||
|
*/
|
||||||
|
public function loginActionRun(): bool
|
||||||
|
{
|
||||||
|
return empty($this->login) ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns current set loginUserId or empty if unset
|
* Returns current set loginUserId or empty if unset
|
||||||
*
|
*
|
||||||
@@ -2167,7 +2177,7 @@ EOM;
|
|||||||
*/
|
*/
|
||||||
public function loginGetLoginUserIdUnclean(): bool
|
public function loginGetLoginUserIdUnclean(): bool
|
||||||
{
|
{
|
||||||
return $this->login_unclear;
|
return $this->login_user_id_unclear;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user