Skip to content

Commit 97ee9fc

Browse files
committed
fixed password check during startup
1 parent 58da5b7 commit 97ee9fc

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

constants/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
2020-21 Benjamin Kellenberger
1111
'''
1212

13-
AIDE_VERSION = '2.1.211118'
13+
AIDE_VERSION = '2.1.211119'
1414

1515

1616
MIN_FILESERVER_VERSION = '2.0.210225' # minimum required version for FileServer, due to recent changes

setup/setupDB.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
os.environ['AIDE_MODULES'] = 'FileServer' # for compatibility with Celery worker import
1515

1616
import argparse
17+
import bcrypt
1718
from constants.version import AIDE_VERSION
1819
from util.configDef import Config
19-
from modules import Database, UserHandling
20+
from modules import Database
2021
from setup.migrate_aide import migrate_aide
2122

2223

@@ -38,8 +39,6 @@ def add_update_superuser(config, dbConn):
3839
adminPass = config.getProperty('Project', 'adminPassword')
3940
if adminPass is None or not len(adminPass):
4041
raise Exception('No password defined for admin account in configuration file.')
41-
uHandler = UserHandling.backend.middleware.UserMiddleware(config, dbConn)
42-
adminPass = uHandler._create_hash(adminPass.encode('utf8'))
4342

4443
# get current values
4544
currentMeta = dbConn.execute('''
@@ -56,7 +55,7 @@ def add_update_superuser(config, dbConn):
5655
currentMeta = currentMeta[0]
5756
if currentMeta['email'] != adminEmail:
5857
changes['adminEmail'] = True
59-
if bytes(currentMeta['hash']) != adminPass:
58+
if not bcrypt.checkpw(adminPass.encode('utf8'), bytes(currentMeta['hash'])):
6059
changes['adminPassword'] = True
6160

6261
if isNewAccount or len(changes):

0 commit comments

Comments
 (0)