Add user creation script
This commit is contained in:
parent
bd6afffd77
commit
02097426ba
|
@ -0,0 +1,18 @@
|
||||||
|
from distutils.fancy_getopt import fancy_getopt
|
||||||
|
from site import USER_BASE
|
||||||
|
from passlib.context import CryptContext
|
||||||
|
from json import load, dump
|
||||||
|
from sys import argv
|
||||||
|
|
||||||
|
with open("app/users.json", 'r+') as f:
|
||||||
|
fake_users_db = load(f)
|
||||||
|
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||||
|
fake_users_db[argv[1]] = {"username": argv[1], "hashed_password": pwd_context.hash(argv[2]),
|
||||||
|
"disabled": False, "servers": argv[3:]}
|
||||||
|
f.seek(0)
|
||||||
|
dump(fake_users_db, f, indent=2)
|
||||||
|
print(fake_users_db)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue