generated from nathanwoodburn/python-webserver-template
fix: Fix domain owner address check
All checks were successful
Build Docker / BuildImage (push) Successful in 2m22s
All checks were successful
Build Docker / BuildImage (push) Successful in 2m22s
This commit is contained in:
10
server.py
10
server.py
@@ -111,15 +111,15 @@ def renew():
|
|||||||
# Check the owner is correct
|
# Check the owner is correct
|
||||||
api = os.getenv("API")
|
api = os.getenv("API")
|
||||||
req = requests.get(f"{api}/verify?domain={domain}")
|
req = requests.get(f"{api}/verify?domain={domain}")
|
||||||
print(json.dumps(req.json(), indent=4))
|
|
||||||
if req.status_code != 200:
|
if req.status_code != 200:
|
||||||
return redirect("/?error=api_error")
|
return redirect("/?error=api_error")
|
||||||
req = req.json()
|
req = req.json()
|
||||||
if req["error"] != None:
|
# Check if error is present
|
||||||
return redirect("/?error=api_error")
|
if "error" in req and req["error"] != None:
|
||||||
|
return redirect(f"/?error={req['error']}")
|
||||||
|
|
||||||
# if req["result"]["owner_tx_data"]["address"] not in allowed_owners:
|
if req["address"] not in allowed_owners:
|
||||||
# return redirect("/?error=not_anyone")
|
return redirect("/?error=not_anyone")
|
||||||
|
|
||||||
return redirect(f"https://pay.hns.au/p/renew?amount=10&data={domain}&redirect=https://renew.hns.au/?message=Pending:%20The%20domain%20will%20renew%20when%20the%20payment%20has%20arrived")
|
return redirect(f"https://pay.hns.au/p/renew?amount=10&data={domain}&redirect=https://renew.hns.au/?message=Pending:%20The%20domain%20will%20renew%20when%20the%20payment%20has%20arrived")
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user