Skip to content

Commit

Permalink
Login flow consistency: Do not use redirect in admin area login box
Browse files Browse the repository at this point in the history
The non-admin login flow does not perform a redirect, but the admin
login flow did. This led to an inconsistency in how the authentication
error message was passed.

Fixes: e107inc/e107#4779
  • Loading branch information
Deltik authored and Jimmi08 committed Sep 8, 2022
1 parent 190f943 commit 3d9f7f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
31 changes: 9 additions & 22 deletions e107_admin/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,7 @@
{
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;

}


Expand Down Expand Up @@ -274,28 +269,20 @@ public function authform() // NOTE: this should NOT be a template of the admin-
// 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'>
Expand Down
2 changes: 1 addition & 1 deletion e107_handlers/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ protected function invalidLogin($username, $reason, $extra_text = '')
$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)
{
Expand Down

0 comments on commit 3d9f7f2

Please sign in to comment.