def doVerify(self):
        """Process the form submission, initating OpenID verification.
        """

        # First, make sure that the user entered something
        openid_url = self.query.get('openid_identifier')
        if not openid_url:
            self.render(
                'Enter an OpenID Identifier to verify.',
                css_class='error',
                form_contents=openid_url)
            return

        immediate = 'immediate' in self.query
        use_sreg = 'use_sreg' in self.query
        use_pape = 'use_pape' in self.query
        use_stateless = 'use_stateless' in self.query
        oidconsumer = self.getConsumer(stateless=use_stateless)
        try:
            request = oidconsumer.begin(openid_url)
        except consumer.DiscoveryFailure as exc:
            fetch_error_string = 'Error in discovery: %s' % (
                cgi.escape(str(exc)))
            self.render(
                fetch_error_string,
                css_class='error',
                form_contents=openid_url)
        else:
            if request is None:
                msg = 'No OpenID services found for <code>%s</code>' % (
                    cgi.escape(openid_url), )
                self.render(msg, css_class='error', form_contents=openid_url)
            else:
                # Then, ask the library to begin the authorization.
                # Here we find out the identity server that will verify the
                # user's identity, and get a token that allows us to
                # communicate securely with the identity server.
                if use_sreg:
                    self.requestRegistrationData(request)

                if use_pape:
                    self.requestPAPEDetails(request)

                trust_root = self.server.base_url
                return_to = self.buildURL('process')
                if request.shouldSendRedirect():
                    redirect_url = request.redirectURL(
                        trust_root, return_to, immediate=immediate)
                    self.send_response(302)
                    self.send_header('Location', redirect_url)
                    self.writeUserHeader()
                    self.end_headers()
                else:
                    form_html = request.htmlMarkup(
                        trust_root,
                        return_to,
                        form_tag_attrs={'id': 'openid_message'},
                        immediate=immediate)

                    self.wfile.write(bytes(form_html, 'utf-8'))
def doVerify ( self ) : openid_url = self . query . get ( 'openid_identifier' ) if not openid_url : self . render ( 'Enter an OpenID Identifier to verify.' , css_class = 'error' , form_contents = openid_url ) return immediate = 'immediate' in self . query use_sreg = 'use_sreg' in self . query use_pape = 'use_pape' in self . query use_stateless = 'use_stateless' in self . query oidconsumer = self . getConsumer ( stateless = use_stateless ) try : request = oidconsumer . begin ( openid_url ) except consumer . DiscoveryFailure as exc : fetch_error_string = 'Error in discovery: %s' % ( cgi . escape ( str ( exc ) ) ) self . render ( fetch_error_string , css_class = 'error' , form_contents = openid_url ) else : if request is None : msg = 'No OpenID services found for <code>%s</code>' % ( cgi . escape ( openid_url ) , ) self . render ( msg , css_class = 'error' , form_contents = openid_url ) else : if use_sreg : self . requestRegistrationData ( request ) if use_pape : self . requestPAPEDetails ( request ) trust_root = self . server . base_url return_to = self . buildURL ( 'process' ) if request . shouldSendRedirect ( ) : redirect_url = request . redirectURL ( trust_root , return_to , immediate = immediate ) self . send_response ( 302 ) self . send_header ( 'Location' , redirect_url ) self . writeUserHeader ( ) self . end_headers ( ) else : form_html = request . htmlMarkup ( trust_root , return_to , form_tag_attrs = { 'id' : 'openid_message' } , immediate = immediate ) self . wfile . write ( bytes ( form_html , 'utf-8' ) )
Process the form submission, initating OpenID verification.