aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2018-02-23 17:37:06 +0300
committerPjotr Prins2018-03-26 09:29:29 +0000
commit9a9fc91dad7fe66883d48826b4cf1a1892a62d54 (patch)
treecaae845b4fb9026e46a521e1fd16d8312288b6c6 /wqflask
parent20d9af4812426e4457e7417cfcea601c1a870168 (diff)
downloadgenenetwork2-9a9fc91dad7fe66883d48826b4cf1a1892a62d54.tar.gz
Provide connections to elasticsearch
* Provide connections to elasticsearch at various points in the code. These oversight was caught while running tests.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/user_manager.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py
index e1920f4e..c344ea27 100644
--- a/wqflask/wqflask/user_manager.py
+++ b/wqflask/wqflask/user_manager.py
@@ -540,6 +540,7 @@ def github_oauth2():
result_dict = {arr[0]:arr[1] for arr in [tok.split("=") for tok in [token.encode("utf-8") for token in result.text.split("&")]]}
github_user = get_github_user_details(result_dict["access_token"])
+ es = get_elasticsearch_connection()
user_details = get_user_by_unique_column(es, "github_id", github_user["id"])
if user_details == None:
user_details = {
@@ -573,6 +574,7 @@ def orcid_oauth2():
result = requests.post(ORCID_TOKEN_URL, data=data)
result_dict = json.loads(result.text.encode("utf-8"))
+ es = get_elasticsearch_connection()
user_details = get_user_by_unique_column(es, "orcid", result_dict["orcid"])
if user_details == None:
user_details = {
@@ -606,6 +608,7 @@ class LoginUser(object):
def oauth2_login(self, login_type, user_id):
"""Login via an OAuth2 provider"""
+ es = get_elasticsearch_connection()
user_details = get_user_by_unique_column(es, "user_id", user_id)
if user_details:
user = model.User()