|
|
@ -84,8 +84,16 @@ class UserCache: |
|
|
|
hashedUserName = hashlib.sha256((userName + self.salt).encode()).hexdigest() |
|
|
|
hashedPassword = hashlib.sha256((password + self.salt).encode()).hexdigest() |
|
|
|
|
|
|
|
## Check if user is in cache |
|
|
|
if hashedUserName in self.cache: |
|
|
|
return self.cache[hashedUserName].checkSecret(hashedPassword) |
|
|
|
## Check if user password is correct |
|
|
|
if self.cache[hashedUserName].checkSecret(hashedPassword): |
|
|
|
return True |
|
|
|
else |
|
|
|
## Delete cache entry if password is wrong |
|
|
|
self.cache.pop(hashedUserName) |
|
|
|
|
|
|
|
return False |
|
|
|
else: |
|
|
|
return False |
|
|
|
|
|
|
|