diff --git a/index.php b/index.php index d59146e3..faa69323 100644 --- a/index.php +++ b/index.php @@ -161,7 +161,7 @@ if ($action == '2fa_entercode') { ]); exit(); } elseif ($action == 'login') { - if (isset($_POST['send']) && $_POST['send'] == 'send') { + if (!empty($_POST)) { $loginname = Validate::validate($_POST['loginname'], 'loginname'); $password = Validate::validate($_POST['password'], 'password'); @@ -431,13 +431,13 @@ if ($action == '2fa_entercode') { } $lastqrystr = ""; if (isset($_REQUEST['qrystr']) && $_REQUEST['qrystr'] != "") { - $lastqrystr = htmlspecialchars($_REQUEST['qrystr'], ENT_QUOTES); + $lastqrystr = urlencode($_REQUEST['qrystr']); } + $_SESSION['lastscript'] = $lastscript; + $_SESSION['lastqrystr'] = $lastqrystr; UI::view('login/login.html.twig', [ 'pagetitle' => 'Login', - 'lastscript' => $lastscript, - 'lastqrystr' => $lastqrystr, 'upd_in_progress' => $update_in_progress, 'message' => $message, 'successmsg' => $successmessage @@ -449,7 +449,7 @@ if ($action == 'forgotpwd') { $adminchecked = false; $message = ''; - if (isset($_POST['send']) && $_POST['send'] == 'send') { + if (!empty($_POST)) { $loginname = Validate::validate($_POST['loginname'], 'loginname'); $email = Validate::validateEmail($_POST['loginemail']); $result_stmt = Database::prepare("SELECT `adminid`, `customerid`, `customernumber`, `firstname`, `name`, `company`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_CUSTOMERS . "` @@ -633,7 +633,7 @@ if ($action == 'forgotpwd') { UI::view('login/fpwd.html.twig', [ 'pagetitle' => lng('login.presend'), - 'action' => $action, + 'formaction' => 'index.php?action='.$action, 'message' => $message, ]); } @@ -656,7 +656,7 @@ if ($action == 'resetpwd') { $check = substr($activationcode, 40, 10); if (substr(md5($third . $timestamp), 0, 10) == $check && $timestamp >= time() - 86400) { - if (isset($_POST['send']) && $_POST['send'] == 'send') { + if (!empty($_POST)) { $stmt = Database::prepare("SELECT `userid`, `admin` FROM `" . TABLE_PANEL_ACTIVATION . "` WHERE `activationcode` = :activationcode"); $result = Database::pexecute_first($stmt, [ @@ -746,29 +746,34 @@ function finishLogin($userinfo) } $qryparams = []; - if (isset($_POST['qrystr']) && $_POST['qrystr'] != "") { - parse_str(urldecode($_POST['qrystr']), $qryparams); + if (isset($_SESSION['lastqrystr']) && !empty($_SESSION['lastqrystr'])) { + parse_str(urldecode($_SESSION['lastqrystr']), $qryparams); + unset($_SESSION['lastqrystr']); } if ($userinfo['adminsession'] == '1') { if (Froxlor::hasUpdates() || Froxlor::hasDbUpdates()) { Response::redirectTo('admin_updates.php?page=overview'); } else { - if (isset($_POST['script']) && $_POST['script'] != "") { - if (preg_match("/customer\_/", $_POST['script']) === 1) { + if (isset($_SESSION['lastscript']) && !empty($_SESSION['lastscript'])) { + $lastscript = $_SESSION['lastscript']; + unset($_SESSION['lastscript']); + if (preg_match("/customer\_/", $lastscript) === 1) { Response::redirectTo('admin_customers.php', [ "page" => "customers" ]); } else { - Response::redirectTo($_POST['script'], $qryparams); + Response::redirectTo($lastscript, $qryparams); } } else { Response::redirectTo('admin_index.php', $qryparams); } } } else { - if (isset($_POST['script']) && $_POST['script'] != "") { - Response::redirectTo($_POST['script'], $qryparams); + if (isset($_SESSION['lastscript']) && !empty($_SESSION['lastscript'])) { + $lastscript = $_SESSION['lastscript']; + unset($_SESSION['lastscript']); + Response::redirectTo($lastscript, $qryparams); } else { Response::redirectTo('customer_index.php', $qryparams); } diff --git a/templates/Froxlor/login/fpwd.html.twig b/templates/Froxlor/login/fpwd.html.twig index e20b3ee0..6832c5ab 100644 --- a/templates/Froxlor/login/fpwd.html.twig +++ b/templates/Froxlor/login/fpwd.html.twig @@ -3,7 +3,7 @@ {% block content %}