Commit d703bd2b authored by Chris Withers's avatar Chris Withers

Collector #1473: zpasswd.py can now accept --username without --password

parent 94dffd34
...@@ -157,6 +157,9 @@ Zope Changes ...@@ -157,6 +157,9 @@ Zope Changes
Bugs fixed Bugs fixed
- Collector #1473: zpasswd.py can now accept --username
without --password
- Collector #1491: talgettext.py did not create a proper header - Collector #1491: talgettext.py did not create a proper header
for the generated .pot file if multiple pagetemplate files for the generated .pot file if multiple pagetemplate files
were processed. were processed.
......
...@@ -99,6 +99,16 @@ def write_access(home, user='', group=''): ...@@ -99,6 +99,16 @@ def write_access(home, user='', group=''):
import do; do.ch(ac_path, user, group) import do; do.ch(ac_path, user, group)
def get_password():
while 1:
password = getpass.getpass("Password: ")
verify = getpass.getpass("Verify password: ")
if verify == password:
return password
else:
password = verify = ''
print "Password mismatch, please try again..."
def write_inituser(home, user='', group=''): def write_inituser(home, user='', group=''):
ac_path=os.path.join(home, 'inituser') ac_path=os.path.join(home, 'inituser')
if not os.path.exists(ac_path): if not os.path.exists(ac_path):
...@@ -163,8 +173,8 @@ def main(): ...@@ -163,8 +173,8 @@ def main():
if opts: if opts:
# There were some command line args, so verify # There were some command line args, so verify
if username is None or password is None: if username is not None and password is None:
usage(1, '-u and -p are required') password = get_password()
else: else:
# No command line args, so prompt # No command line args, so prompt
while 1: while 1:
...@@ -172,14 +182,7 @@ def main(): ...@@ -172,14 +182,7 @@ def main():
if username != '': if username != '':
break break
while 1: password = get_password()
password = getpass.getpass("Password: ")
verify = getpass.getpass("Verify password: ")
if verify == password:
break
else:
password = verify = ''
print "Password mismatch, please try again..."
while 1: while 1:
print """ print """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment