Преглед изворни кода

[Web] Fix oAuth logout after authentication (if enabled)

andryyy пре 5 година
родитељ
комит
565feada7e
2 измењених фајлова са 4 додато и 8 уклоњено
  1. 4 0
      data/web/oauth/authorize.php
  2. 0 8
      data/web/oauth/profile.php

+ 4 - 0
data/web/oauth/authorize.php

@@ -60,6 +60,10 @@ $is_authorized = ($_POST['authorized'] == '1');
 $oauth2_server->handleAuthorizeRequest($request, $response, $is_authorized, $_SESSION['mailcow_cc_username']);
 if ($is_authorized) {
   unset($_SESSION['oauth2_request']);
+  if ($GLOBALS['OAUTH2_FORGET_SESSION_AFTER_LOGIN'] === true) {
+    session_unset();
+    session_destroy();
+  }
   header('Location: ' . $response->getHttpHeader('Location'));
   exit;
 }

+ 0 - 8
data/web/oauth/profile.php

@@ -22,16 +22,8 @@ if (!empty($mailbox)) {
       'modified' => (!empty($mailbox['modified']) ? $mailbox['modified'] : ''),
       'active' => (!empty($mailbox['active']) ? $mailbox['active'] : ''),
     ));
-    if ($GLOBALS['OAUTH2_FORGET_SESSION_AFTER_LOGIN'] === true) {
-      session_unset();
-      session_destroy();
-    }
     exit;
   }
-  if ($GLOBALS['OAUTH2_FORGET_SESSION_AFTER_LOGIN'] === true) {
-    session_unset();
-    session_destroy();
-  }
 }
 echo json_encode(array(
   'success' => false