Navigation Menu

Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Removing code from index.php, adding dependency in OAuthWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
ghecquet committed Mar 11, 2016
1 parent 35e2f6d commit 72980ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion core/src/core/classes/guzzle/composer.json
Expand Up @@ -3,6 +3,7 @@
"guzzlehttp/guzzle": "~5",
"guzzlehttp/command": "~0.7",
"guzzlehttp/guzzle-services": "~0.5",
"gimler/guzzle-description-loader" : "*"
"gimler/guzzle-description-loader" : "*",
"commerceguys/guzzle-oauth2-plugin": "~2.0"
}
}
3 changes: 0 additions & 3 deletions core/src/index.php
Expand Up @@ -68,9 +68,6 @@
}
session_start();

if (isSet($_GET['code'])) {
$_SESSION['oauth_code'] = AJXP_Utils::sanitize($_GET['code'], AJXP_SANITIZE_ALPHANUM);
}
if (isSet($_GET["tmp_repository_id"]) || isSet($_POST["tmp_repository_id"])) {
try{
ConfService::switchRootDir(isset($_GET["tmp_repository_id"])?$_GET["tmp_repository_id"]:$_POST["tmp_repository_id"], true);
Expand Down
6 changes: 5 additions & 1 deletion core/src/plugins/core.access/src/Stream/OAuthWrapper.php
Expand Up @@ -38,6 +38,10 @@ class OAuthWrapper extends AJXP_SchemeTranslatorWrapper
*/
public static function applyInitPathHook($url) {

if (!class_exists('CommerceGuys\Guzzle\Oauth2\Oauth2Subscriber')) {
throw new Exception('Oauth plugin not loaded - go to ' . AJXP_BIN_FOLDER . '/guzzle from the command line and run \'composer update\' to install');
}

// Repository information
$urlParts = AJXP_Utils::safeParseUrl($url);
$repository = ConfService::getRepositoryById($urlParts["host"]);
Expand Down Expand Up @@ -132,7 +136,7 @@ public static function applyInitPathHook($url) {
$accessToken = $oauth2->getAccessToken();
$refreshToken = $oauth2->getRefreshToken();
} catch (\Exception $e) {
throw new AJXP_UserAlertException("Please go to <a style=\"text-decoration:underline;\" target=\"_blank\" href=\"" . $authUrl . "\">" . $authUrl . "</a> to authorize the access to your onedrive. Then try again to switch to this workspace");
throw new AJXP_UserAlertException("Please go to <a style=\"text-decoration:underline;\" href=\"" . $authUrl . "\">" . $authUrl . "</a> to authorize the access to your onedrive. Then try again to switch to this workspace");
}

// Saving tokens for later use
Expand Down

0 comments on commit 72980ff

Please sign in to comment.