From b4e4ca152256e1f1f06359d584034554db06402e Mon Sep 17 00:00:00 2001
From: Muriithi Frederick Muriuki
Date: Wed, 10 Jan 2018 15:07:11 +0300
Subject: Add template elements for OAuth login
* Add html elements that will be used to prompt users to login with
either GitHub or ORCID.
---
wqflask/wqflask/templates/new_security/login_user.html | 18 ++++++++++++++++--
wqflask/wqflask/user_manager.py | 9 ++++++++-
2 files changed, 24 insertions(+), 3 deletions(-)
(limited to 'wqflask')
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 @@
Create a new account
-
-
+
+ Login with external services
+
+ {% if external_login: %}
+
+
+
+ {% endif %}
Already have an account? Sign in here.
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()
--
cgit v1.2.3