Skip to content
Snippets Groups Projects
Verified Commit c9cf962d authored by Mark's avatar Mark
Browse files

Refactor grapqhl calls to use variable function

parent 269f9819
No related branches found
No related tags found
1 merge request!3Change login provider backend to graphql
Pipeline #559 failed with stages
in 4 minutes and 16 seconds
...@@ -15,23 +15,28 @@ class User(UserMixin): ...@@ -15,23 +15,28 @@ class User(UserMixin):
self._load_remote_user_info() self._load_remote_user_info()
def _load_remote_user_info(self): def _load_remote_user_info(self):
querystring = '''{{ querystring = '''{
getUser(username: "{0}"){{ getUser(username: $username){
email, email,
active active
}}}}'''.format(self.username).strip() }}'''
result = loads(graphql_client.execute(querystring)) result = loads(graphql_client.execute(querystring, {'username': self.username}))
if "data" in result: if "data" in result:
self.active = result["data"]["getUser"]["active"] self.active = result["data"]["getUser"]["active"]
self.email = result["data"]["getUser"]["email"] self.email = result["data"]["getUser"]["email"]
def _verify_password(self, password): def _verify_password(self, password):
querystring = '''{{ querystring = '''{
verifyPassword( verifyPassword(
username: "{0}", username: $username,
password: "{1}") password: $password)
}}'''.format(self.username, password).strip() }}'''
result = loads(graphql_client.execute(querystring)) result = loads(
graphql_client.execute(querystring, {
'username': self.username,
'password': password
})
)
verified = False verified = False
if "data" in result: if "data" in result:
verified = result["data"]["verifyPassword"] verified = result["data"]["verifyPassword"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment