diff --git a/pagure/flask_app.py b/pagure/flask_app.py index 8352c7c..8a053d4 100644 --- a/pagure/flask_app.py +++ b/pagure/flask_app.py @@ -107,36 +107,6 @@ def create_app(config=None): os.path.join(app.root_path, 'static'), ] - @app.context_processor - def context_processor(): - def user_can_clone_ssh(username): - ssh_keys = '' - if flask.g.authenticated: - ssh_keys = pagure.lib.search_user( - flask.g.session, - username=flask.g.fas_user.username - ).public_ssh_key or '' - if not (pagure_config.get('ALWAYS_RENDER_SSH_CLONE_URL') - or ssh_keys.strip()): - return False - return True - - def get_git_url_ssh(): - """ Return the GIT SSH URL to be displayed in the UI based on the - content of the configuration file. - """ - git_url_ssh = pagure_config.get('GIT_URL_SSH') - if flask.g.authenticated and git_url_ssh: - try: - git_url_ssh = git_url_ssh.format( - username=flask.g.fas_user.username) - except (KeyError, IndexError): - pass - return git_url_ssh - - return {'user_can_clone_ssh': user_can_clone_ssh, - 'git_url_ssh': get_git_url_ssh()} - auth = pagure_config.get('PAGURE_AUTH', None) if auth in ['fas', 'openid']: # Only import and set flask_fas_openid if it is needed diff --git a/pagure/templates/repo_master.html b/pagure/templates/repo_master.html index f71b2cc..44a4457 100644 --- a/pagure/templates/repo_master.html +++ b/pagure/templates/repo_master.html @@ -1,7 +1,7 @@ {% extends "master.html" %} -{% macro print_ssh_url(repo, git_url_ssh, current_user) %} - {% if not user_can_clone_ssh(current_user) %} +{% macro print_ssh_url(repo, end_url_ssh, current_user) %} + {% if not (current_user |user_can_clone_ssh) %} You need to upload SSH key to be able to clone over SSH @@ -13,7 +13,7 @@