Code Duplication    Length = 17-17 lines in 2 locations

oauth2callback.php 2 locations

@@ 13-29 (lines=17) @@
10
        $google->redirect();
11
        die();
12
    }
13
    else
14
    {
15
        $res = $google->authenticate($_GET['code'], $currentUser);
16
        switch($res)
17
        {
18
            case \Auth\Authenticator::SUCCESS:
19
                header('Location: '.$ref);
20
                die();
21
            default:
22
            case \Auth\Authenticator::LOGIN_FAILED:
23
                header('Location: login.php');
24
                die();
25
            case \Auth\Authenticator::ALREADY_PRESENT:
26
                header('Location: user_exists.php?src='.$src.'&uid='.$currentUser->uid);
27
                die();
28
        }
29
    }
30
}
31
32
$auth = AuthProvider::getInstance();
@@ 65-81 (lines=17) @@
62
            $twitter->redirect();
63
            die();
64
        }
65
        else
66
        {
67
            $twitter->authenticate($_GET['oauth_token'], $_GET['oauth_verifier'], $current_user);
68
            switch($res)
69
            {
70
                case \Auth\Authenticator::SUCCESS:
71
                    header('Location: '.$ref);
72
                    die();
73
                default:
74
                case \Auth\Authenticator::LOGIN_FAILED:
75
                    header('Location: login.php');
76
                    die();
77
                case \Auth\Authenticator::ALREADY_PRESENT:
78
                    header('Location: user_exists.php?src=twitter&uid='.$current_user->uid);
79
                    die();
80
            }
81
        }
82
        break;
83
    case 'gitlab':
84
        doAuthByType('Auth\OAuth2\GitLabAuthenticator', $src, $auth, $ref);