1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

Merge pull request #4865 from Deltik/fix/4779

Fixes: #4779 Login flow consistency: Do not use redirect in admin area login box
This commit is contained in:
Cameron 2022-09-29 12:14:12 -07:00 committed by GitHub
commit 43153ab662
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 25 deletions

View File

@ -134,12 +134,7 @@ else
{
e107::coreLan('log_messages', true);
e107::getLog()->addEvent(4, __FILE__."|".__FUNCTION__."@".__LINE__, "LOGIN", LAN_ROLL_LOG_11, "U: ".e107::getParser()->toDB($_POST['authname']), FALSE, LOG_TO_ROLLING);
e107::getRedirect()->redirect('admin.php?failed');
}
exit;
}
@ -274,28 +269,20 @@ class auth
// Start Clean
// NOTE: this should NOT be a template of the admin-template, however themes may style it using css.
$class = (e_QUERY === 'failed') ? "class='e-shake'" : "";
$text = "<form id='admin-login' method='post' action='".e_SELF."' {$incChap} >
<div id='logo' ><img src='".e_IMAGE."logo_template_large.png' alt='".LAN_LOGIN."' /></div>
<div id='login-admin' class='center'>
<div>";
if(e_QUERY === 'failed')
{
e107::lan('core', 'login');
$text .= e107::getMessage()->render(); // see e107_handlers/login.php L622
$text .= "<script>
window.setTimeout(function() {
$('.alert').fadeTo(500, 0).slideUp(500, function(){
$(this).remove();
});
}, 7000);
</script>";
}
e107::lan('core', 'login');
$text .= e107::getMessage()->render(); // see e107_handlers/login.php L622
$text .= "<script>
window.setTimeout(function() {
$('.alert').fadeTo(500, 0).slideUp(500, function(){
$(this).remove();
});
}, 7000);
</script>";
$text .= "
<div class='panel well panel-primary'>

View File

@ -649,7 +649,7 @@ class userlogin
$this->logNote('LAN_ROLL_LOG_10', $username);
}
e107::getMessage()->reset()->addError($message, 'default', true); // prevent duplicates, session=true needed for admin-area login.
e107::getMessage()->reset()->addError($message); // prevent duplicates
if($this->testMode === true)
{

View File

@ -11,7 +11,19 @@ class AdminLoginCest
{
}
// tests
/**
* @see https://github.com/e107inc/e107/issues/4779
*/
public function testAdminFailedLogin(AcceptanceTester $I)
{
$I->wantTo("See a login failure message in the admin area if I put in the wrong credentials");
$I->amOnPage("/e107_admin/admin.php");
$I->fillField('authname', 'e107');
$I->fillField('authpass', 'wrong password');
$I->click('authsubmit');
$I->see("Your login details don't match any registered user");
}
public function testAdminLogin(AcceptanceTester $I)
{
@ -27,7 +39,6 @@ class AdminLoginCest
}
private function e107Login(AcceptanceTester $I)
{
$I->amOnPage('/e107_admin/admin.php');