1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added password confirmation prompt

This commit is contained in:
krateng 2022-02-13 05:56:36 +01:00
parent d3797d89fa
commit 38e2a184af

View File

@ -63,12 +63,16 @@ def setup():
print("Password has been set.") print("Password has been set.")
elif auth.defaultuser.checkpw("admin"): elif auth.defaultuser.checkpw("admin"):
# if the actual pw is admin, it means we've never set this up properly (eg first start after update) # if the actual pw is admin, it means we've never set this up properly (eg first start after update)
newpw = prompt("Please set a password for web backend access. Leave this empty to generate a random password.",skip=SKIP,secret=True) newpw, newpw_repeat = 1, 2
if newpw is None: while newpw != newpw_repeat:
newpw = randomstring(32) newpw = prompt("Please set a password for web backend access. Leave this empty to generate a random password.",skip=SKIP,secret=True)
print("Generated password:",col["yellow"](newpw)) if newpw is None:
newpw = randomstring(32)
auth.defaultuser.setpw(newpw) print("Generated password:",col["yellow"](newpw))
else:
newpw_repeat = prompt("Please type again to confirm.",skip=SKIP,secret=True)
if newpw != newpw_repeat: print("Passwords do not match!")
else: auth.defaultuser.setpw(newpw)
if malojaconfig["SEND_STATS"] is None: if malojaconfig["SEND_STATS"] is None:
answer = ask("I would like to know how many people use Maloja. Would it be okay to send a daily ping to my server (this contains no data that isn't accessible via your web interface already)?",default=True,skip=SKIP) answer = ask("I would like to know how many people use Maloja. Would it be okay to send a daily ping to my server (this contains no data that isn't accessible via your web interface already)?",default=True,skip=SKIP)