allow existing blank chpw.json (closes #1038);

previously, would crash on startup if chpw.json exists and is blank,
because valid json was enforced

now allowing a blank initial file to match the behavior of sqlite
This commit is contained in:
ed
2025-12-14 17:24:54 +00:00
parent 921954037b
commit efc6a09dd3

View File

@@ -3306,7 +3306,7 @@ class AuthSrv(object):
pwdb = {}
else:
jtxt = read_utf8(self.log, ap, True)
pwdb = json.loads(jtxt)
pwdb = json.loads(jtxt) if jtxt.strip() else {}
pwdb = [x for x in pwdb if x[0] != uname]
pwdb.append((uname, self.defpw[uname], hpw))
@@ -3330,7 +3330,7 @@ class AuthSrv(object):
return
jtxt = read_utf8(self.log, ap, True)
pwdb = json.loads(jtxt)
pwdb = json.loads(jtxt) if jtxt.strip() else {}
useen = set()
urst = set()