aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorPjotr Prins2018-03-20 09:41:36 +0000
committerPjotr Prins2018-03-20 09:51:06 +0000
commitfd236176d9011887662a0203f9af4a2f206b5af2 (patch)
tree03c02f4fae93dd81bf99e4598a9b857e4099f588 /wqflask
parent7ab7a55f68178aa55d9e242d74f2a2d28f6e2aba (diff)
downloadgenenetwork2-fd236176d9011887662a0203f9af4a2f206b5af2.tar.gz
Authentication: some mods around defaults
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/utility/tools.py15
-rw-r--r--wqflask/wqflask/templates/new_security/login_user.html2
-rw-r--r--wqflask/wqflask/user_manager.py13
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"