From aaca711f63d557020b618f498b195cefed42d6a2 Mon Sep 17 00:00:00 2001 From: Jonas Leder <jonas@jonasled.de> Date: Sat, 9 Nov 2019 12:41:22 +0100 Subject: [PATCH] added some comments to recaptcha verify --- main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index fd2166c..f994e3c 100644 --- a/main.py +++ b/main.py @@ -103,14 +103,14 @@ def makeQR(text): #This function is used to create a QR code and encode it base6 return base64.b64encode(buffer.getvalue()).decode() -def grecaptcha_verify(request): +def grecaptcha_verify(request): #This function is used to verify the google recaptcha code, that is send to the server after submitting a new link captcha_rs = request.form.get('g-recaptcha-response') - url = "https://www.google.com/recaptcha/api/siteverify" - headers = {'User-Agent': 'DebuguearApi-Browser',} - params = {'secret': recaptchaPrivateKey, 'response': captcha_rs} - verify_rs = post(url,params, headers=headers) + url = "https://www.google.com/recaptcha/api/siteverify" #The baseurl + headers = {'User-Agent': 'DebuguearApi-Browser',} #Useragent doesn't matters, but is set here + params = {'secret': recaptchaPrivateKey, 'response': captcha_rs} #As paramtere we send to google our private Key and the key from the user + verify_rs = post(url,params, headers=headers) #Send a post request with the parameters from before to googlde verify_rs = verify_rs.json() - response = verify_rs.get("success", False) + response = verify_rs.get("success", False) #Verify that the response includes the success, if so return True, if not return False return response -- GitLab