mapname -> namemap

pull/4/head
Blake DeMarcy 2017-03-03 00:15:13 -06:00
parent a4eb9f241a
commit a9634b9aea
2 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ try:
USERDB = json.loads(f.read())
except FileNotFoundError:
USERDB = dict(mapname=dict())
USERDB = dict(namemap=dict())
with open(path.join(PATH, "userdb"), "w") as f:
f.write(json.dumps(USERDB))
path.os.chmod(path.join(PATH, "userdb"), 0o600)
@ -95,19 +95,19 @@ def user_resolve(name_or_id):
if check:
return name_or_id
else:
return USERDB["mapname"][name_or_id]
return USERDB["namemap"][name_or_id]
except KeyError:
return False
def user_register(auth_hash, name, quip, bio):
if USERDB["mapname"].get(name):
if USERDB["namemap"].get(name):
return schema.error(4, "Username taken.")
ID = uuid1().hex
scheme = schema.user_internal(ID, auth_hash, name, quip, bio, False)
USERDB.update({ID: scheme})
USERDB["mapname"].update({name: ID})
USERDB["namemap"].update({name: ID})
user_dbdump(USERDB)
return scheme

View File

@ -32,7 +32,7 @@ def create_usermap(thread, index=False):
def is_registered(json):
return bool(db.USERDB["mapname"].get(json["target_user"]))
return bool(db.USERDB["namemap"].get(json["target_user"]))
def check_auth(json):