@@ -24,18 +24,18 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | switch($src) |
| 26 | 26 | { |
| 27 | - case 'google': |
|
| 28 | - $google = $auth->getMethodByName('Auth\GoogleAuthenticator'); |
|
| 29 | - if(!isset($_GET['code'])) |
|
| 30 | - { |
|
| 31 | - $google->redirect(); |
|
| 32 | - die(); |
|
| 33 | - } |
|
| 34 | - else |
|
| 35 | - { |
|
| 36 | - $res = $google->authenticate($_GET['code'], $current_user); |
|
| 37 | - switch($res) |
|
| 27 | + case 'google': |
|
| 28 | + $google = $auth->getMethodByName('Auth\GoogleAuthenticator'); |
|
| 29 | + if(!isset($_GET['code'])) |
|
| 30 | + { |
|
| 31 | + $google->redirect(); |
|
| 32 | + die(); |
|
| 33 | + } |
|
| 34 | + else |
|
| 38 | 35 | { |
| 36 | + $res = $google->authenticate($_GET['code'], $current_user); |
|
| 37 | + switch($res) |
|
| 38 | + { |
|
| 39 | 39 | case \Auth\Authenticator::SUCCESS: |
| 40 | 40 | header('Location: '.$ref); |
| 41 | 41 | die(); |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | case \Auth\Authenticator::ALREADY_PRESENT: |
| 47 | 47 | header('Location: user_exists.php?src=google&uid='.$current_user->uid); |
| 48 | 48 | die(); |
| 49 | - } |
|
| 49 | + } |
|
| 50 | 50 | } |
| 51 | 51 | break; |
| 52 | - case 'twitter': |
|
| 53 | - $twitter = $auth->getMethodByName('Auth\TwitterAuthenticator'); |
|
| 54 | - if(!isset($_GET['oauth_token']) || !isset($_GET['oauth_verifier'])) |
|
| 55 | - { |
|
| 56 | - $twitter->redirect(); |
|
| 57 | - die(); |
|
| 58 | - } |
|
| 59 | - else |
|
| 60 | - { |
|
| 61 | - $twitter->authenticate($_GET['oauth_token'], $_GET['oauth_verifier'], $current_user); |
|
| 62 | - switch($res) |
|
| 52 | + case 'twitter': |
|
| 53 | + $twitter = $auth->getMethodByName('Auth\TwitterAuthenticator'); |
|
| 54 | + if(!isset($_GET['oauth_token']) || !isset($_GET['oauth_verifier'])) |
|
| 55 | + { |
|
| 56 | + $twitter->redirect(); |
|
| 57 | + die(); |
|
| 58 | + } |
|
| 59 | + else |
|
| 63 | 60 | { |
| 61 | + $twitter->authenticate($_GET['oauth_token'], $_GET['oauth_verifier'], $current_user); |
|
| 62 | + switch($res) |
|
| 63 | + { |
|
| 64 | 64 | case \Auth\Authenticator::SUCCESS: |
| 65 | 65 | header('Location: '.$ref); |
| 66 | 66 | die(); |
@@ -71,21 +71,21 @@ discard block |
||
| 71 | 71 | case \Auth\Authenticator::ALREADY_PRESENT: |
| 72 | 72 | header('Location: user_exists.php?src=twitter&uid='.$current_user->uid); |
| 73 | 73 | die(); |
| 74 | - } |
|
| 74 | + } |
|
| 75 | 75 | } |
| 76 | 76 | break; |
| 77 | - case 'gitlab': |
|
| 78 | - $gitlab = $auth->getMethodByName('Auth\OAuth2\GitLabAuthenticator'); |
|
| 79 | - if(!isset($_GET['code'])) |
|
| 80 | - { |
|
| 81 | - $google->redirect(); |
|
| 82 | - die(); |
|
| 83 | - } |
|
| 84 | - else |
|
| 85 | - { |
|
| 86 | - $res = $gitlab->authenticate($_GET['code'], $current_user); |
|
| 87 | - switch($res) |
|
| 77 | + case 'gitlab': |
|
| 78 | + $gitlab = $auth->getMethodByName('Auth\OAuth2\GitLabAuthenticator'); |
|
| 79 | + if(!isset($_GET['code'])) |
|
| 80 | + { |
|
| 81 | + $google->redirect(); |
|
| 82 | + die(); |
|
| 83 | + } |
|
| 84 | + else |
|
| 88 | 85 | { |
| 86 | + $res = $gitlab->authenticate($_GET['code'], $current_user); |
|
| 87 | + switch($res) |
|
| 88 | + { |
|
| 89 | 89 | case \Auth\Authenticator::SUCCESS: |
| 90 | 90 | header('Location: '.$ref); |
| 91 | 91 | die(); |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | case \Auth\Authenticator::ALREADY_PRESENT: |
| 97 | 97 | header('Location: user_exists.php?src=gitlab&uid='.$current_user->uid); |
| 98 | 98 | die(); |
| 99 | - } |
|
| 99 | + } |
|
| 100 | 100 | } |
| 101 | 101 | //Generic OAuth... |
| 102 | - default: |
|
| 103 | - print_r($_SERVER); |
|
| 104 | - break; |
|
| 102 | + default: |
|
| 103 | + print_r($_SERVER); |
|
| 104 | + break; |
|
| 105 | 105 | } |
| 106 | 106 | /* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | return $response->withJson($group); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - protected function serializeArray(&$res, $array, $type=false) |
|
| 107 | + protected function serializeArray(&$res, $array, $type = false) |
|
| 108 | 108 | { |
| 109 | 109 | $count = count($array); |
| 110 | 110 | for($i = 0; $i < $count; $i++) |