Skip to content

Commit

Permalink
forgot break in switch and fix qq error desc
Browse files Browse the repository at this point in the history
  • Loading branch information
ideal committed Jun 13, 2015
1 parent a12e449 commit e4fc8dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions upload/src/applications/u/controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ public function thirdlogincallbackAction()
$result = $service->getAccessToken($platform, $authcode);
if (!$result[0]) {
if (is_array($result[1])) {
$this->showError('USER:third.platform.dataerror.detail',
array('{code}' => $result[1][0], '{msg}' => $result[1][1]));
$error = new PwError('USER:third.platform.dataerror.detail',
array('{code}' => $result[1][0], '{msg}' => $result[1][1]));
$this->showError($error->getError());
} else {
$this->showError('USER:third.platform.dataerror');
}
Expand Down
10 changes: 7 additions & 3 deletions upload/src/applications/u/service/PwThirdLoginService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
* @version $Id: PwThirdLoginService.php 24383 2015-06-13 14:10:47Z ideal $
* @package products.u.service
*/

Wind::import('WSRV:base.WindidUtility');

class PwThirdLoginService
{
public static $supportedPlatforms = array(
Expand Down Expand Up @@ -73,6 +76,7 @@ public function getAccessToken($platform, $authcode)
$authcode,
urlencode($redirecturl)
);
break;
default:
// should never happen
return array(false, '');
Expand All @@ -84,9 +88,9 @@ public function getAccessToken($platform, $authcode)
}
switch($platform) {
case 'qq':
parse_str($data, $result);
if (isset($result['code'])) {
return array(false, array($result['code'], $result['msg']));
$result = json_decode(substr($data, 10, -4), true);
if (isset($result['error'])) {
return array(false, array($result['error'], $result['error_description']));
} else {
return array(true, $result['access_token']);
}
Expand Down

0 comments on commit e4fc8dc

Please sign in to comment.