Skip to content

Commit

Permalink
fix authorize
Browse files Browse the repository at this point in the history
  • Loading branch information
musicman3 committed May 26, 2023
1 parent 428ff6c commit df950da
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/eMarket/model/eMarket/Core/Authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ public function __construct() {
}

session_start();
$this->csrfVerification();

if (Settings::path() == 'admin' && Valid::inGET('route') != 'login') {
$this->csrfVerification();
$this->admin();
}

if (Settings::path() == 'catalog') {
$this->csrfVerification();
$this->catalog();
new Cart();
}
Expand Down Expand Up @@ -96,16 +95,14 @@ public static function csrfToken(): string {
*/
private function csrfVerification(): void {

$csrf_session_token = $_SESSION[Settings::$csrf[Settings::path()]];

if (Valid::isPOST()) {
if (!Valid::inPOST('csrf_token') || Valid::inPOST('csrf_token') != $csrf_session_token) {
if (!Valid::inPOST('csrf_token') || Valid::inPOST('csrf_token') != $_SESSION[Settings::$csrf[Settings::path()]]) {
echo 'CSRF Token Error!';
exit;
}
}
if (Valid::isPostJson()) {
if (!Valid::inPostJson('csrf_token') || Valid::inPostJson('csrf_token') != $csrf_session_token) {
if (!Valid::inPostJson('csrf_token') || Valid::inPostJson('csrf_token') != $_SESSION[Settings::$csrf[Settings::path()]]) {
echo 'CSRF Token Error!';
exit;
}
Expand Down

0 comments on commit df950da

Please sign in to comment.