Changeset 20301 for extensions/oAuth/auth.php
- Timestamp:
- Jan 20, 2013, 9:41:55 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/oAuth/auth.php
r20293 r20301 9 9 10 10 try { 11 // inputs 11 12 if ( $provider == 'OpenID' and !isset($_GET['openid_identifier']) ) 12 13 { 13 throw new Exception('Invalid OpenID!' );14 throw new Exception('Invalid OpenID!', 1003); 14 15 } 15 16 16 // inputs17 17 if ( 18 18 !array_key_exists($provider, $hybridauth_conf['providers']) 19 19 or !$hybridauth_conf['providers'][$provider]['enabled'] 20 20 ) { 21 throw new Exception('Hacking attempt!' );21 throw new Exception('Hacking attempt!', 1002); 22 22 } 23 24 25 23 26 24 $hybridauth = new Hybrid_Auth($hybridauth_conf); … … 29 27 if ($hybridauth->isConnectedWith($provider)) 30 28 { 31 $template->assign('AUTH_DONE', true);32 33 29 $adapter = $hybridauth->getAdapter($provider); 34 30 $remote_user = $adapter->getUserProfile(); … … 69 65 else if (isset($_GET['init_auth'])) 70 66 { 71 $params = array('hauth_return_to', get_absolute_root_url() .OAUTH_PATH.'auth.php?provider='.$provider.'&auth_done=1');67 $params = array('hauth_return_to', get_absolute_root_url() . OAUTH_PATH . 'auth.php?provider='.$provider.'&auth_done=1'); 72 68 if ($provider == 'OpenID') 73 69 { … … 83 79 $template->assign('LOADING', '&openid_identifier='.@$_GET['openid_identifier'].'&init_auth=1'); 84 80 } 85 } 86 catch( Exception $e ){ 87 $template->assign('ERROR', $e->getMessage()); 81 } 82 /* 83 library errors : 84 0 : Unspecified error 85 1 : Hybriauth configuration error 86 2 : Provider not properly configured 87 3 : Unknown or disabled provider 88 4 : Missing provider application credentials 89 5 : Authentication aborded 90 other errors : 91 1002 : Invalid provider 92 1003 : Missing openid_identifier 93 */ 94 catch (Exception $e) { 95 switch ($e->getCode()) { 96 case 5: 97 $template->assign('ERROR', l10n('Authentication canceled')); break; 98 default: 99 $template->assign('ERROR', sprintf(l10n('An error occured, please contact the gallery owner. <i>Error code : %s</i>'), $e->getCode())); 100 } 88 101 } 89 102 … … 96 109 'OAUTH_PATH' => OAUTH_PATH, 97 110 'PROVIDER' => $provider, 98 'SELF_URL' => OAUTH_PATH .'auth.php?provider='.$provider,111 'SELF_URL' => OAUTH_PATH . 'auth.php?provider='.$provider, 99 112 )); 100 113 101 $template->set_filename('index', realpath(OAUTH_PATH .'template/auth.tpl'));114 $template->set_filename('index', realpath(OAUTH_PATH . 'template/auth.tpl')); 102 115 $template->pparse('index'); 103 116 ?>
Note: See TracChangeset
for help on using the changeset viewer.