4 usage: %(progname)s username 9 import os, sys, string, time, getopt
15 from pyclearsilver
import odb, hdfhelp, odb_sqlite3
16 from pyclearsilver
import CSPage
22 row = db.users.new(username, password)
24 row.changePassword = 1
29 print __doc__ % vars()
31 def main(argv, stdout, environ):
33 optlist, args = getopt.getopt(argv[1:],
"", [
"help",
"test",
"debug",
"admin"])
36 if len(args)
not in (1, 2):
42 for (field, val)
in optlist:
46 elif field ==
"--debug":
48 elif field ==
"--test":
50 elif field ==
"--admin":
57 db = db_auth.initSchema(create=0)
63 print "---------------" 64 print "Creating new user:" 65 print " Username: %s" % username
66 print " Password: %s" % password1
67 print "You will be asked to change this password the first time you log in to the web interface." 71 print "New User: %s" % username
72 print "---------------------------" 75 print "Please enter a password:" 76 password1 = getpass.getpass(
"Password 1:")
77 password2 = getpass.getpass(
"Password 2:")
78 if password1 != password2:
79 print "password mismatch." 84 user =
createuser(db, username, password1, role=role)
89 if __name__ ==
"__main__":
90 main(sys.argv, sys.stdout, os.environ)
def main(argv, stdout, environ)
def createuser(db, username, password, role="")