fixed bug, sodass auch ein user sich einloggen kann, wenn er noch nicht in der datenbank ist

This commit is contained in:
Tim Gröger 2020-06-08 16:41:48 +02:00
parent c7e1c981e6
commit ba16743fde
2 changed files with 6 additions and 4 deletions

View File

@ -9,8 +9,9 @@ from geruecht.model.user import User
class Base:
def getCreditListFromUser(self, user, **kwargs):
try:
if user.uid == 'extern':
return []
if type(user) is User:
if user.uid == 'extern':
return []
cursor = self.db.connection.cursor()
if 'year' in kwargs:
sql = "select * from creditList where user_id={} and year_date={}".format(user.id if type(user) is User else user, kwargs['year'])

View File

@ -38,8 +38,9 @@ class Base:
retVal.initGeruechte(creditLists)
if workgroups:
retVal.workgroups = self.getWorkgroupsOfUser(retVal.id)
if retVal.uid == username:
return retVal
if retVal:
if retVal.uid == username:
return retVal
else:
return None
except Exception as err: