19 lines
529 B
Python
19 lines
529 B
Python
|
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)
|
||
|
|
||
|
|
||
|
|
||
|
|