forked from p15670423/monkey
Fix CR
This commit is contained in:
parent
38cf36e165
commit
ddc93a67fa
|
@ -10,10 +10,10 @@ __author__ = 'itay.mizeretz'
|
||||||
|
|
||||||
|
|
||||||
class User(object):
|
class User(object):
|
||||||
def __init__(self, id, username, password):
|
def __init__(self, id, username, secret):
|
||||||
self.id = id
|
self.id = id
|
||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.secret = secret
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "User(id='%s')" % self.id
|
return "User(id='%s')" % self.id
|
||||||
|
@ -24,9 +24,9 @@ def init_jwt(app):
|
||||||
username_table = {u.username: u for u in users}
|
username_table = {u.username: u for u in users}
|
||||||
userid_table = {u.id: u for u in users}
|
userid_table = {u.id: u for u in users}
|
||||||
|
|
||||||
def authenticate(username, password):
|
def authenticate(username, secret):
|
||||||
user = username_table.get(username, None)
|
user = username_table.get(username, None)
|
||||||
if user and safe_str_cmp(user.password.encode('utf-8'), password.encode('utf-8')):
|
if user and safe_str_cmp(user.secret.encode('utf-8'), secret.encode('utf-8')):
|
||||||
return user
|
return user
|
||||||
|
|
||||||
def identity(payload):
|
def identity(payload):
|
||||||
|
|
|
@ -15,4 +15,9 @@ def load_env_from_file():
|
||||||
return config_json['server_config']
|
return config_json['server_config']
|
||||||
|
|
||||||
|
|
||||||
env = ENV_DICT[load_env_from_file()]()
|
try:
|
||||||
|
__env_type = load_env_from_file()
|
||||||
|
env = ENV_DICT[__env_type]()
|
||||||
|
except Exception:
|
||||||
|
print('Failed initializing environment: %s' % __env_type)
|
||||||
|
raise
|
||||||
|
|
Loading…
Reference in New Issue