mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 00:52:16 -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:
|
if LEELOO_DALLAS in all_users:
|
||||||
raise Exception("sorry, reserved username: " + LEELOO_DALLAS)
|
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 = {}
|
seenpwds = {}
|
||||||
for usr, pwd in acct.items():
|
for usr, pwd in acct.items():
|
||||||
if pwd in seenpwds:
|
if pwd in seenpwds:
|
||||||
|
|
Loading…
Reference in a new issue