예제 #1
0
 def get_authorization_url(self, nexturl='/'):
     params = {
         'client_id': self.client_id,
         'response_type': 'code',
         'redirect_uri': self.callback_url + '&next_url=' + nexturl
     }
     url = self.AUTH_URL + "?" + urlparse.urlencode(params)
     return url
예제 #2
0
 def get_authorization_url(self, nexturl='/'):
     params = {
         'client_id': self.client_id,
         'response_type': 'code',
         'redirect_uri': self.callback_url + '&next_url=' + nexturl,
         'scope': 'user'
     }
     # url = self.AUTH_URL + "?" + urllib.parse.urlencode(params, quote_via=urllib.parse.quote)
     url = self.AUTH_URL + "?" + urlparse.urlencode(params)
     return url
예제 #3
0
 def verify_recaptcha(self):
     """ Checks recaptcha """
     recaptcha_challenge = self.get_argument("recaptcha_challenge_field", "")
     recaptcha_response = self.get_argument("recaptcha_response_field", "")
     recaptcha_req_data = {
         "privatekey": self.config.recaptcha_private_key,
         "remoteip": self.request.remote_ip,
         "challenge": recaptcha_challenge,
         "response": recaptcha_response,
     }
     try:
         recaptcha_http = tornado.httpclient.AsyncHTTPClient()
         recaptcha_req_body = urlparse.urlencode(recaptcha_req_data)
         recaptcha_http.fetch(
             RECAPTCHA_URL,
             self.recaptcha_callback,
             method="POST",
             body=recaptcha_req_body,
         )
     except tornado.httpclient.HTTPError:
         logging.exception("Recaptcha AsyncHTTP request threw an exception")
         self.recaptcha_callback(None)
         self.render_page(errors=["Error making backend recaptcha request"])