lowercase all hashes
parent
634a868030
commit
ef4e07054a
|
@ -59,7 +59,7 @@ def api_method(function):
|
||||||
if not user:
|
if not user:
|
||||||
raise BBJUserError("User %s is not registered" % username)
|
raise BBJUserError("User %s is not registered" % username)
|
||||||
|
|
||||||
elif auth != user["auth_hash"]:
|
elif auth.lower() != user["auth_hash"].lower():
|
||||||
raise BBJException(5, "Invalid authorization key for user.")
|
raise BBJException(5, "Invalid authorization key for user.")
|
||||||
|
|
||||||
# api_methods may choose to bind a usermap into the thread_data
|
# api_methods may choose to bind a usermap into the thread_data
|
||||||
|
@ -233,7 +233,7 @@ class API(object):
|
||||||
"""
|
"""
|
||||||
validate(args, ["target_user", "target_hash"])
|
validate(args, ["target_user", "target_hash"])
|
||||||
user = db.user_resolve(database, args["target_user"], return_false=False)
|
user = db.user_resolve(database, args["target_user"], return_false=False)
|
||||||
return args["target_hash"] == user["auth_hash"]
|
return args["target_hash"].lower() == user["auth_hash"].lower()
|
||||||
|
|
||||||
|
|
||||||
@api_method
|
@api_method
|
||||||
|
|
|
@ -338,7 +338,7 @@ def user_register(connection, user_name, auth_hash):
|
||||||
raise BBJUserError("Username already registered")
|
raise BBJUserError("Username already registered")
|
||||||
|
|
||||||
scheme = schema.user_internal(
|
scheme = schema.user_internal(
|
||||||
uuid1().hex, user_name, auth_hash,
|
uuid1().hex, user_name, auth_hash.lower(),
|
||||||
"", "", 0, False, time())
|
"", "", 0, False, time())
|
||||||
|
|
||||||
connection.execute("""
|
connection.execute("""
|
||||||
|
@ -391,6 +391,8 @@ def user_update(connection, user_object, parameters):
|
||||||
# bool(0) == False hur hur hurrrrrr ::drools::
|
# bool(0) == False hur hur hurrrrrr ::drools::
|
||||||
if value == 0 or value:
|
if value == 0 or value:
|
||||||
validate([(key, value)])
|
validate([(key, value)])
|
||||||
|
if key == "auth_hash":
|
||||||
|
value = value.lower()
|
||||||
user_object[key] = value
|
user_object[key] = value
|
||||||
|
|
||||||
values = ordered_keys(user_object,
|
values = ordered_keys(user_object,
|
||||||
|
|
|
@ -83,7 +83,7 @@ def user_internal(
|
||||||
return {
|
return {
|
||||||
"user_id": user_id,
|
"user_id": user_id,
|
||||||
"user_name": user_name,
|
"user_name": user_name,
|
||||||
"auth_hash": auth_hash,
|
"auth_hash": auth_hash.lower(),
|
||||||
"quip": quip,
|
"quip": quip,
|
||||||
"bio": bio,
|
"bio": bio,
|
||||||
"color": color,
|
"color": color,
|
||||||
|
|
Loading…
Reference in New Issue