From e0efb68fec3d0f19c3b8772b70364aef0e0abf88 Mon Sep 17 00:00:00 2001 From: cdujeu Date: Fri, 23 Jan 2015 22:10:33 +0100 Subject: [PATCH] Make sure to re-display the authorization URL in case of step 2 error. --- .../access.dropbox/class.dropboxAccessDriver.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/plugins/access.dropbox/class.dropboxAccessDriver.php b/core/src/plugins/access.dropbox/class.dropboxAccessDriver.php index 29670f935b..c135a9235f 100644 --- a/core/src/plugins/access.dropbox/class.dropboxAccessDriver.php +++ b/core/src/plugins/access.dropbox/class.dropboxAccessDriver.php @@ -85,18 +85,22 @@ public function initRepository() //echo "Step 2: You must now redirect the user to:\n"; $_SESSION['DROPBOX_NEGOCIATION_STATE'] = 2; $_SESSION['oauth_tokens'] = $tokens; - throw new Exception("Please go to getAuthorizeUrl()."\">".$oauth->getAuthorizeUrl()." to authorize the access to your dropbox. Then try again to switch to this repository."); + throw new Exception("Please go to getAuthorizeUrl()."\">".$oauth->getAuthorizeUrl()." to authorize the access to your dropbox. Then try again to switch to this workspace."); case 2 : $oauth->setToken($_SESSION['oauth_tokens']); - $tokens = $oauth->getAccessToken(); + try{ + $tokens = $oauth->getAccessToken(); + }catch(Exception $oauthEx){ + throw new Exception($oauthEx->getMessage() . ". Please go to getAuthorizeUrl()."\">".$oauth->getAuthorizeUrl()." to authorize the access to your dropbox. Then try again to switch to this workspace."); + } $_SESSION['DROPBOX_NEGOCIATION_STATE'] = 3; $_SESSION['OAUTH_DROPBOX_TOKENS'] = $tokens; $this->setTokens($tokens); return; } - throw new Exception("Impossible to find the tokens for accessing the dropbox repository"); + throw new Exception("Impossible to find the dropbox tokens for accessing this workspace"); }