mirror of
https://github.com/RoboSats/robosats.git
synced 2025-09-13 00:56:22 +00:00
Fix misaligned error codes
This commit is contained in:
@ -77,7 +77,7 @@ class RobotTokenSHA256AuthenticationMiddleWare:
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
if not is_valid_token(token_sha256_b91):
|
if not is_valid_token(token_sha256_b91):
|
||||||
return JsonResponse(new_error(7001), status=status.HTTP_400_BAD_REQUEST)
|
return JsonResponse(new_error(7000), status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
# Check if it is an existing robot.
|
# Check if it is an existing robot.
|
||||||
try:
|
try:
|
||||||
@ -124,7 +124,7 @@ class RobotTokenSHA256AuthenticationMiddleWare:
|
|||||||
encrypted_private_key = request.COOKIES.get("encrypted_private_key", "")
|
encrypted_private_key = request.COOKIES.get("encrypted_private_key", "")
|
||||||
|
|
||||||
if not public_key or not encrypted_private_key or not nostr_pubkey:
|
if not public_key or not encrypted_private_key or not nostr_pubkey:
|
||||||
return JsonResponse(new_error(7002), status=status.HTTP_400_BAD_REQUEST)
|
return JsonResponse(new_error(7001), status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
(
|
(
|
||||||
valid,
|
valid,
|
||||||
@ -133,7 +133,7 @@ class RobotTokenSHA256AuthenticationMiddleWare:
|
|||||||
encrypted_private_key,
|
encrypted_private_key,
|
||||||
) = validate_pgp_keys(public_key, encrypted_private_key)
|
) = validate_pgp_keys(public_key, encrypted_private_key)
|
||||||
if not valid:
|
if not valid:
|
||||||
return JsonResponse(new_error(7003, {"bad_keys_context": bad_keys_context}), status=status.HTTP_400_BAD_REQUEST)
|
return JsonResponse(new_error(7002, {"bad_keys_context": bad_keys_context}), status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
# Hash the token_sha256, only 1 iteration.
|
# Hash the token_sha256, only 1 iteration.
|
||||||
# This is the second SHA256 of the user token, aka RoboSats ID
|
# This is the second SHA256 of the user token, aka RoboSats ID
|
||||||
|
|||||||
Reference in New Issue
Block a user