Jiří Kalvoda
2 years ago
3 changed files with 2 additions and 25 deletions
@ -1,23 +0,0 @@ |
|||||
#!/usr/bin/env python3 |
|
||||
|
|
||||
import argparse |
|
||||
from hra.util import hash_passwd |
|
||||
from sqlalchemy import exc, update |
|
||||
import sys |
|
||||
|
|
||||
import hra.db as db |
|
||||
|
|
||||
parser = argparse.ArgumentParser() |
|
||||
parser.add_argument("username", help="Username") |
|
||||
parser.add_argument("passwd", help="Password") |
|
||||
|
|
||||
args = parser.parse_args() |
|
||||
|
|
||||
u = db.User(org=True, username=args.username, passwd=hash_passwd(args.passwd)) |
|
||||
try: |
|
||||
db.get_session().add(u) |
|
||||
db.get_session().commit() |
|
||||
except exc.IntegrityError: |
|
||||
print("Uživatelské jméno již existuje") |
|
||||
sys.exit(1) |
|
||||
print("Přidán nový uživatel.") |
|
Loading…
Reference in new issue