diff options
author | Muriithi Frederick Muriuki | 2018-01-10 15:07:11 +0300 |
---|---|---|
committer | Muriithi Frederick Muriuki | 2018-01-10 15:07:11 +0300 |
commit | b4e4ca152256e1f1f06359d584034554db06402e (patch) | |
tree | 54f9d1818df4eae09bda2228f938f1dbf0705e07 | |
parent | a9c9de15c395b1e49244c6063c9c1cb204e450da (diff) | |
download | genenetwork2-b4e4ca152256e1f1f06359d584034554db06402e.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.
-rw-r--r-- | wqflask/wqflask/templates/new_security/login_user.html | 18 | ||||
-rw-r--r-- | wqflask/wqflask/user_manager.py | 9 |
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() |