Check if Token is None
This commit is contained in:
parent
534e6ad9c3
commit
6f011bab67
@ -47,9 +47,10 @@ def validate(token):
|
||||
|
||||
class TokensAuth(TokenAuth):
|
||||
def check_auth(self, token, allowed_roles, resource, method):
|
||||
if not token:
|
||||
return False
|
||||
tokens = app.data.driver.db['tokens']
|
||||
lookup = {'token': token, 'updated': {"$gt": datetime.now()}}
|
||||
dbtoken = None
|
||||
dbtoken = tokens.find_one(lookup)
|
||||
if not dbtoken:
|
||||
validation = validate(token)
|
||||
@ -61,7 +62,7 @@ class TokensAuth(TokenAuth):
|
||||
}
|
||||
tokens.insert(data)
|
||||
else:
|
||||
validation = {'valid': True}
|
||||
return True
|
||||
return validation['valid']
|
||||
"""
|
||||
users = app.data.driver.db['users']
|
||||
|
Loading…
x
Reference in New Issue
Block a user