request = $request; return $this; } public function setOAuthProvider($provider) { $this->provider = $provider; return $this; } public function render() { $request = $this->request; $provider = $this->provider; $provider_name = $provider->getProviderName(); $diagnose = null; $view = new AphrontRequestFailureView(); $view->setHeader($provider_name.' Auth Failed'); if ($this->request) { $view->appendChild( hsprintf( '

Description: %s

', $request->getStr('error_description'))); $view->appendChild( hsprintf( '

Error: %s

', $request->getStr('error'))); $view->appendChild( hsprintf( '

Error Reason: %s

', $request->getStr('error_reason'))); } else { // TODO: We can probably refine this. $view->appendChild( hsprintf( '

Unable to authenticate with %s. '. 'There are several reasons this might happen:

'. ''. '

You can try again, or login using another method.

', $provider_name, $provider_name, $provider_name, $provider_name)); $provider_key = $provider->getProviderKey(); $diagnose = hsprintf( ''. 'Diagnose %s OAuth Problems'. '', $provider_name); } $view->appendChild( '
'. $diagnose. 'Continue'. '
'); return $view->render(); } }