diff --git a/main.py b/main.py index fd2166cc18010644ee5a9887b11e437c1820b7f5..f994e3cff92fa3926ac26b85b7375daf43402057 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