From 0ebb52e64f25047b16913d942897af42e5891bfc Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 24 Feb 2017 21:07:28 -0800 Subject: [PATCH] conf: simplify newlogins checks & allow missing permissions blocks if an old login is also present --- conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf.py b/conf.py index db768f6..1a08975 100644 --- a/conf.py +++ b/conf.py @@ -75,15 +75,15 @@ def validateConf(conf, logger=None): old_login_valid = type(conf['login'].get('password')) == type(conf['login'].get('user')) == str newlogins = conf['login'].get('accounts', {}) - new_login_valid = len(newlogins) >= 1 - validate(old_login_valid or new_login_valid, "No accounts were set, aborting!") + + validate(old_login_valid or newlogins, "No accounts were set, aborting!") for account, block in newlogins.items(): validate(type(account) == str, "Bad username format %s" % account) validate(type(block.get('password')) == str, "Bad password %s for account %s" % (block.get('password'), account)) validate(conf['login'].get('password') != "changeme", "You have not set the login details correctly!") - if newlogins: + if newlogins and not old_login_valid: validate(conf.get('permissions'), "New-style accounts enabled but no permissions block was found. You will not be able to administrate your PyLink instance!") return conf