Merge pull request #1191 from jakedt/properties

Convert some flask-login user methods to properties
This commit is contained in:
Jake Moshenko 2016-01-29 10:47:39 -05:00
commit 9c83ec32c6

View file

@ -324,7 +324,7 @@ def buildlogs(build_uuid):
@route_show_if(features.BILLING) @route_show_if(features.BILLING)
@require_session_login @require_session_login
def receipt(): def receipt():
if not current_user.is_authenticated(): if not current_user.is_authenticated:
abort(401) abort(401)
return return
@ -455,7 +455,7 @@ class FlaskAuthorizationProvider(model.oauth.DatabaseAuthorizationProvider):
@web.route('/oauth/authorizeapp', methods=['POST']) @web.route('/oauth/authorizeapp', methods=['POST'])
@csrf_protect @csrf_protect
def authorize_application(): def authorize_application():
if not current_user.is_authenticated(): if not current_user.is_authenticated:
abort(401) abort(401)
return return
@ -471,7 +471,7 @@ def authorize_application():
@web.route(app.config['LOCAL_OAUTH_HANDLER'], methods=['GET']) @web.route(app.config['LOCAL_OAUTH_HANDLER'], methods=['GET'])
def oauth_local_handler(): def oauth_local_handler():
if not current_user.is_authenticated(): if not current_user.is_authenticated:
abort(401) abort(401)
return return
@ -484,7 +484,7 @@ def oauth_local_handler():
@web.route('/oauth/denyapp', methods=['POST']) @web.route('/oauth/denyapp', methods=['POST'])
@csrf_protect @csrf_protect
def deny_application(): def deny_application():
if not current_user.is_authenticated(): if not current_user.is_authenticated:
abort(401) abort(401)
return return
@ -509,7 +509,7 @@ def request_authorization_code():
redirect_uri = request.args.get('redirect_uri', None) redirect_uri = request.args.get('redirect_uri', None)
scope = request.args.get('scope', None) scope = request.args.get('scope', None)
if (not current_user.is_authenticated() or if (not current_user.is_authenticated or
not provider.validate_has_scopes(client_id, current_user.db_user().username, scope)): not provider.validate_has_scopes(client_id, current_user.db_user().username, scope)):
if not provider.validate_redirect_uri(client_id, redirect_uri): if not provider.validate_redirect_uri(client_id, redirect_uri):
current_app = provider.get_application_for_client_id(client_id) current_app = provider.get_application_for_client_id(client_id)