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

Commit

Permalink
Make sure to re-display the authorization URL in case of step 2 error.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Jan 23, 2015
1 parent 5522988 commit e0efb68
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/src/plugins/access.dropbox/class.dropboxAccessDriver.php
Expand Up @@ -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 <a style=\"text-decoration:underline;\" target=\"_blank\" href=\"".$oauth->getAuthorizeUrl()."\">".$oauth->getAuthorizeUrl()."</a> to authorize the access to your dropbox. Then try again to switch to this repository.");
throw new Exception("Please go to <a style=\"text-decoration:underline;\" target=\"_blank\" href=\"".$oauth->getAuthorizeUrl()."\">".$oauth->getAuthorizeUrl()."</a> 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 <a style=\"text-decoration:underline;\" target=\"_blank\" href=\"".$oauth->getAuthorizeUrl()."\">".$oauth->getAuthorizeUrl()."</a> 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");

}

Expand Down

0 comments on commit e0efb68

Please sign in to comment.