diff options
author | Pjotr Prins | 2018-03-20 09:41:36 +0000 |
---|---|---|
committer | Pjotr Prins | 2018-03-26 09:29:29 +0000 |
commit | 2b75b5d56c99d58e205aed59e721bf578489e802 (patch) | |
tree | 564290ee1cef73d759ea89217400122857ea141c /wqflask | |
parent | 690a9f716219c868932d2e6fe4071633dd0257ee (diff) | |
download | genenetwork2-2b75b5d56c99d58e205aed59e721bf578489e802.tar.gz |
Authentication: some mods around defaults
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/utility/tools.py | 15 | ||||
-rw-r--r-- | wqflask/wqflask/templates/new_security/login_user.html | 2 | ||||
-rw-r--r-- | wqflask/wqflask/user_manager.py | 13 |
3 files changed, 16 insertions, 14 deletions
diff --git a/wqflask/utility/tools.py b/wqflask/utility/tools.py index bae3a7f4..ed54f77c 100644 --- a/wqflask/utility/tools.py +++ b/wqflask/utility/tools.py @@ -254,15 +254,18 @@ JS_GN_PATH = get_setting('JS_GN_PATH') GITHUB_CLIENT_ID = get_setting('GITHUB_CLIENT_ID') GITHUB_CLIENT_SECRET = get_setting('GITHUB_CLIENT_SECRET') GITHUB_AUTH_URL = None -if GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET: - GITHUB_AUTH_URL = "https://github.com/login/oauth/authorize?client_id="+GITHUB_CLIENT_ID+"&client_secret="+GITHUB_CLIENT_SECRET -GITHUB_API_URL = get_setting('GITHUB_API_URL') +if GITHUB_CLIENT_ID != 'UNKNOWN' and GITHUB_CLIENT_SECRET: + GITHUB_AUTH_URL = "https://github.com/login/oauth/authorize?client_id=" + \ + GITHUB_CLIENT_ID+"&client_secret="+GITHUB_CLIENT_SECRET + GITHUB_API_URL = get_setting('GITHUB_API_URL') + ORCID_CLIENT_ID = get_setting('ORCID_CLIENT_ID') ORCID_CLIENT_SECRET = get_setting('ORCID_CLIENT_SECRET') ORCID_AUTH_URL = None -if ORCID_CLIENT_ID and ORCID_CLIENT_SECRET: - ORCID_AUTH_URL = "https://sandbox.orcid.org/oauth/authorize?response_type=code&scope=/authenticate&show_login=true&client_id="+ORCID_CLIENT_ID+"&client_secret="+ORCID_CLIENT_SECRET -ORCID_TOKEN_URL = get_setting('ORCID_TOKEN_URL') +if ORCID_CLIENT_ID != 'UNKNOWN' and ORCID_CLIENT_SECRET: + ORCID_AUTH_URL = "https://sandbox.orcid.org/oauth/authorize?response_type=code&scope=/authenticate&show_login=true&client_id=" + + ORCID_CLIENT_ID+"&client_secret="+ORCID_CLIENT_SECRET + ORCID_TOKEN_URL = get_setting('ORCID_TOKEN_URL') ELASTICSEARCH_HOST = get_setting('ELASTICSEARCH_HOST') ELASTICSEARCH_PORT = get_setting('ELASTICSEARCH_PORT') diff --git a/wqflask/wqflask/templates/new_security/login_user.html b/wqflask/wqflask/templates/new_security/login_user.html index 0dae3503..6d597f6b 100644 --- a/wqflask/wqflask/templates/new_security/login_user.html +++ b/wqflask/wqflask/templates/new_security/login_user.html @@ -88,7 +88,7 @@ </form> {% else: %} <div class="alert alert-warning"> - <p>You cannot login at this moment using your GeneNetwork account.<br /> + <p>You cannot login at this moment using your GeneNetwork account (the authentication service is down).<br /> Please try again later.</p> </div> {% endif %} diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py index c344ea27..c55649f3 100644 --- a/wqflask/wqflask/user_manager.py +++ b/wqflask/wqflask/user_manager.py @@ -626,13 +626,12 @@ class LoginUser(object): logger.debug("in login params are:", params) es = get_elasticsearch_connection() if not params: - from utility.tools import GITHUB_AUTH_URL, ORCID_AUTH_URL - external_login = None - if GITHUB_AUTH_URL or ORCID_AUTH_URL: - external_login={ - "github": GITHUB_AUTH_URL, - "orcid": ORCID_AUTH_URL - } + from utility.tools import GITHUB_AUTH_URL, GITHUB_CLIENT_ID, ORCID_AUTH_URL, ORCID_CLIENT_ID + external_login = {} + if GITHUB_AUTH_URL and GITHUB_CLIENT_ID != 'UNKNOWN': + external_login["github"] = GITHUB_AUTH_URL + if ORCID_AUTH_URL and ORCID_CLIENT_ID != 'UNKNOWN': + external_login["orcid"] = ORCID_AUTH_URL assert(es is not None) return render_template( "new_security/login_user.html" |