You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
from hra.util import hash_passwd
|
|
|
|
from sqlalchemy import exc, update
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import hra.db as db
|
|
|
|
import hra.lib as lib
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("username", help="Username")
|
|
|
|
parser.add_argument("passwd", help="Password")
|
|
|
|
parser.add_argument("--org", help="Přidělí org prává", action='store_true')
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
try:
|
|
|
|
u = lib.create_user(args.username, args.passwd, org=args.org)
|
|
|
|
except lib.UsernameExist:
|
|
|
|
print("Uživatelské jméno již existuje")
|
|
|
|
sys.exit(1)
|
|
|
|
db.get_session().commit()
|
|
|
|
print("Přidán nový uživatel.")
|
|
|
|
print(u.token)
|