From ddc93a67fa08258632d8376fb396288f70a96408 Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Sun, 25 Feb 2018 18:23:52 +0200 Subject: [PATCH] Fix CR --- monkey_island/cc/auth.py | 8 ++++---- monkey_island/cc/environment/environment.py | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/monkey_island/cc/auth.py b/monkey_island/cc/auth.py index 99667d837..a32d6ec9d 100644 --- a/monkey_island/cc/auth.py +++ b/monkey_island/cc/auth.py @@ -10,10 +10,10 @@ __author__ = 'itay.mizeretz' class User(object): - def __init__(self, id, username, password): + def __init__(self, id, username, secret): self.id = id self.username = username - self.password = password + self.secret = secret def __str__(self): return "User(id='%s')" % self.id @@ -24,9 +24,9 @@ def init_jwt(app): username_table = {u.username: 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) - 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 def identity(payload): diff --git a/monkey_island/cc/environment/environment.py b/monkey_island/cc/environment/environment.py index 5cb992c7c..8eb97a999 100644 --- a/monkey_island/cc/environment/environment.py +++ b/monkey_island/cc/environment/environment.py @@ -15,4 +15,9 @@ def load_env_from_file(): 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