mirror of
https://github.com/9001/copyparty.git
synced 2025-08-16 08:32:13 -06:00
autogen pw for blank-pw users (closes #596);
if a user is defined with a blank password, generate a strong password for that user
This commit is contained in:
parent
68907eaf48
commit
7f44875061
|
@ -1885,6 +1885,16 @@ class AuthSrv(object):
|
|||
if LEELOO_DALLAS in all_users:
|
||||
raise Exception("sorry, reserved username: " + LEELOO_DALLAS)
|
||||
|
||||
zsl = []
|
||||
for usr in list(acct)[:]:
|
||||
zs = acct[usr].strip()
|
||||
if not zs:
|
||||
zs = ub64enc(os.urandom(48)).decode("ascii")
|
||||
zsl.append(usr)
|
||||
acct[usr] = zs
|
||||
if zsl:
|
||||
self.log("generated random passwords for users %r" % (zsl,), 6)
|
||||
|
||||
seenpwds = {}
|
||||
for usr, pwd in acct.items():
|
||||
if pwd in seenpwds:
|
||||
|
|
Loading…
Reference in a new issue