diff options
author | Muriithi Frederick Muriuki | 2018-02-23 17:37:06 +0300 |
---|---|---|
committer | Muriithi Frederick Muriuki | 2018-02-23 17:37:06 +0300 |
commit | 1ee48887d93cace2d1b00b2f1adc9a6407fdb882 (patch) | |
tree | 820a4b1ea2fa2ff564e037be83e90773f702edf2 /wqflask | |
parent | 4d656976eae920066261e26bf22a999d90a0beab (diff) | |
download | genenetwork2-1ee48887d93cace2d1b00b2f1adc9a6407fdb882.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.py | 3 |
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() |