aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2018-01-10 15:07:11 +0300
committerPjotr Prins2018-03-26 09:24:34 +0000
commit06a34983c913f697f10f0440240cffb28f5ddb79 (patch)
tree765bf88029141bd8c42128b34a17f96fef71dca8 /wqflask
parent121ecdeb9d923e9964969007ac56210fb17e2c4d (diff)
downloadgenenetwork2-06a34983c913f697f10f0440240cffb28f5ddb79.tar.gz
Add template elements for OAuth login
* Add html elements that will be used to prompt users to login with either GitHub or ORCID.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/templates/new_security/login_user.html18
-rw-r--r--wqflask/wqflask/user_manager.py9
2 files changed, 24 insertions, 3 deletions
diff --git a/wqflask/wqflask/templates/new_security/login_user.html b/wqflask/wqflask/templates/new_security/login_user.html
index b9f49a61..15f0a27e 100644
--- a/wqflask/wqflask/templates/new_security/login_user.html
+++ b/wqflask/wqflask/templates/new_security/login_user.html
@@ -18,8 +18,22 @@
<a href="/n/register" class="btn btn-primary modalize">Create a new account</a>
-
- <hr />
+ <hr />
+ <h4>Login with external services</h4>
+
+ {% if external_login: %}
+ <div>
+ {% if external_login["github"]: %}
+ <a href="{{external_login['github']}}" title="Login with GitHub" class="btn btn-info btn-group">Login with Github</a>
+ {% endif %}
+
+ {% if external_login["orcid"]: %}
+ <a href="{{external_login['orcid']}}" title="Login with ORCID" class="btn btn-info btn-group">Login with ORCID</a>
+ {% endif %}
+ </div>
+
+ <hr />
+ {% endif %}
<h4>Already have an account? Sign in here.</h4>
diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py
index f7fcd2d0..25833464 100644
--- a/wqflask/wqflask/user_manager.py
+++ b/wqflask/wqflask/user_manager.py
@@ -506,7 +506,14 @@ class LoginUser(object):
params = request.form if request.form else request.args
logger.debug("in login params are:", params)
if not params:
- return render_template("new_security/login_user.html")
+ 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
+ }
+ return render_template("new_security/login_user.html", external_login=external_login)
else:
try:
user = model.User.query.filter_by(email_address=params['email_address']).one()