From 956dae892723ab65d072c4ef1e4dfd1037054464 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Thu, 25 May 2023 12:32:47 +0200 Subject: [PATCH] [Web] handle fatal errors on getAccessToken --- data/web/inc/functions.inc.php | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php index 7ed89b72..441fd2a6 100644 --- a/data/web/inc/functions.inc.php +++ b/data/web/inc/functions.inc.php @@ -1974,6 +1974,9 @@ function identity_provider($_action, $_data = null, $_extra = null) { $pdo->rollback(); return false; } + if ($setting == "server_url" || $setting == "authorize_url" || $setting == "token_url" || $setting == "userinfo_url") { + $_data[$setting] = rtrim($_data[$setting], '/'); + } $stmt->bindParam(':key', $setting); $stmt->bindParam(':value', $_data[$setting]); @@ -2101,15 +2104,6 @@ function identity_provider($_action, $_data = null, $_extra = null) { try { $token = $provider->getAccessToken('authorization_code', ['code' => $_GET['code']]); - } catch (Exception $e) { - $_SESSION['return'][] = array( - 'type' => 'danger', - 'log' => array(__FUNCTION__), - 'msg' => array('login_failed', $e->getMessage()) - ); - return false; - } - try { $_SESSION['iam_token'] = $token->getToken(); $_SESSION['iam_refresh_token'] = $token->getRefreshToken(); $info = $provider->getResourceOwner($token)->toArray(); @@ -2121,7 +2115,6 @@ function identity_provider($_action, $_data = null, $_extra = null) { ); return false; } - // check if email address is given if (empty($info['email'])) return false; @@ -2204,15 +2197,6 @@ function identity_provider($_action, $_data = null, $_extra = null) { try { $token = $provider->getAccessToken('refresh_token', ['refresh_token' => $_SESSION['iam_refresh_token']]); - } catch (Exception $e) { - $_SESSION['return'][] = array( - 'type' => 'danger', - 'log' => array(__FUNCTION__), - 'msg' => array('login_failed', $e->getMessage()) - ); - return false; - } - try { $_SESSION['iam_token'] = $token->getToken(); $_SESSION['iam_refresh_token'] = $token->getRefreshToken(); $info = $provider->getResourceOwner($token)->toArray();