Turn off all references and API calls to github login if the feature is disabled

This commit is contained in:
Joseph Schorr 2014-04-06 00:50:30 -04:00
parent 19a20a6c94
commit badf002e92
6 changed files with 22 additions and 9 deletions

View file

@ -3,7 +3,7 @@ import logging
from flask import request, redirect, url_for, Blueprint
from flask.ext.login import current_user
from endpoints.common import render_page_template, common_login
from endpoints.common import render_page_template, common_login, route_show_if
from app import app, mixpanel
from data import model
from util.names import parse_repository_name
@ -11,6 +11,7 @@ from util.http import abort
from auth.permissions import AdministerRepositoryPermission
from auth.auth import require_session_login
import features
logger = logging.getLogger(__name__)
@ -48,6 +49,7 @@ def get_github_user(token):
@callback.route('/github/callback', methods=['GET'])
@route_show_if(features.GITHUB_LOGIN)
def github_oauth_callback():
error = request.args.get('error', None)
if error:
@ -101,6 +103,7 @@ def github_oauth_callback():
@callback.route('/github/callback/attach', methods=['GET'])
@route_show_if(features.GITHUB_LOGIN)
@require_session_login
def github_oauth_attach():
token = exchange_github_code_for_token(request.args.get('code'))