Update app.py
Browse files
app.py
CHANGED
|
@@ -9,18 +9,19 @@ HCAPTCHA_SECRET = os.environ.get("HCAPTCHA_SECRET")
|
|
| 9 |
|
| 10 |
@app.route("/")
|
| 11 |
def index():
|
| 12 |
-
# Serve index.html langsung dari root
|
| 13 |
return send_file("index.html")
|
| 14 |
|
| 15 |
@app.route("/verify", methods=["POST"])
|
| 16 |
def verify():
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
if not token:
|
| 19 |
return jsonify({"success": False, "error": "❌ No token received"}), 400
|
| 20 |
|
| 21 |
url = "https://hcaptcha.com/siteverify"
|
| 22 |
-
|
| 23 |
-
result = requests.post(url, data=
|
| 24 |
|
| 25 |
return jsonify(result)
|
| 26 |
|
|
|
|
| 9 |
|
| 10 |
@app.route("/")
|
| 11 |
def index():
|
|
|
|
| 12 |
return send_file("index.html")
|
| 13 |
|
| 14 |
@app.route("/verify", methods=["POST"])
|
| 15 |
def verify():
|
| 16 |
+
data = request.get_json()
|
| 17 |
+
token = data.get("token") if data else None
|
| 18 |
+
|
| 19 |
if not token:
|
| 20 |
return jsonify({"success": False, "error": "❌ No token received"}), 400
|
| 21 |
|
| 22 |
url = "https://hcaptcha.com/siteverify"
|
| 23 |
+
payload = {"secret": HCAPTCHA_SECRET, "response": token}
|
| 24 |
+
result = requests.post(url, data=payload).json()
|
| 25 |
|
| 26 |
return jsonify(result)
|
| 27 |
|