Code Duplication    Length = 17-17 lines in 2 locations

oauth2callback.php 2 locations

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