diff options
author | Zach Copley <zach@status.net> | 2010-10-07 13:51:47 -0700 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-10-07 13:51:47 -0700 |
commit | b8f2cc4e6f121f4ffacefb6fe632beb3b25eb126 (patch) | |
tree | 3175e669c8baeea67ab1845102db4b9e339fe3c3 | |
parent | 82a0a1a74b9452fbc122fed9ee9c4e0a86b7a79e (diff) |
Make the verifier pin display a little nicer
-rw-r--r-- | actions/apioauthauthorize.php | 25 | ||||
-rw-r--r-- | actions/apioauthpin.php | 16 | ||||
-rwxr-xr-x | tests/oauth/fetch_temp_creds.php | 2 |
3 files changed, 24 insertions, 19 deletions
diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php index 6772052f2..d0b621140 100644 --- a/actions/apioauthauthorize.php +++ b/actions/apioauthauthorize.php @@ -449,21 +449,28 @@ class ApiOauthAuthorizeAction extends Action function showAuthorized() { + $title = sprintf( + _("You have successfully authorized %s."), + $this->app->name + ); - if ($this->reqToken->verified_callback == 'oob') { + $msg = sprintf( + _('Please return to %s and enter the following security code to complete the process.'), + $this->app->name + ); - $pin = new ApiOauthPinAction($this->reqToken->verifier); + if ($this->reqToken->verified_callback == 'oob') { + $pin = new ApiOauthPinAction($title, $msg, $this->reqToken->verifier); $pin->showPage(); - } else { + // NOTE: This should probably never happen; trhow an error instead? + $info = new InfoAction( - _("Authorization succeeded."), - sprintf( - _('The request token %s has been authorized. Please exchange it for an access token using this verifier: %s'), - $this->oauthTokenParam, - $this->reqToken->verifier - ) + $title, + $msg, + $this->oauthTokenParam, + $this->reqToken->verifier ); $info->showPage(); diff --git a/actions/apioauthpin.php b/actions/apioauthpin.php index 5a88b5e59..5e6713a54 100644 --- a/actions/apioauthpin.php +++ b/actions/apioauthpin.php @@ -36,6 +36,8 @@ require_once INSTALLDIR . '/lib/info.php'; /** * Class for displaying an OAuth verifier pin * + * XXX: I'm pretty sure we don't need to check the logged in state here. -- Zach + * * @category Action * @package StatusNet * @author Zach Copley <zach@status.net> @@ -45,16 +47,13 @@ require_once INSTALLDIR . '/lib/info.php'; class ApiOauthPinAction extends InfoAction { - - function __construct($verifier) + function __construct($title, $message, $verifier) { $this->verifier = $verifier; - $title = _('Authorization succeeded.'); - parent::__construct($title, $title); + $this->title = $title; + parent::__construct($title, $message); } - // TODO: Check for logged in state! - /** * Display content. * @@ -62,8 +61,7 @@ class ApiOauthPinAction extends InfoAction */ function showContent() { - // XXX: make this much nicer - $this->element('div', array('class' => 'info'), $this->verifier); + $this->element('div', array('class' => 'info'), $this->message); + $this->element('div', array('id' => 'oauth_pin'), $this->verifier); } - } diff --git a/tests/oauth/fetch_temp_creds.php b/tests/oauth/fetch_temp_creds.php index 73f502af3..63ca351cd 100755 --- a/tests/oauth/fetch_temp_creds.php +++ b/tests/oauth/fetch_temp_creds.php @@ -56,7 +56,7 @@ try { } catch (Exception $e) { // oh noez print $e->getMessage(); - print "OAuth Request:\n"; + print "\nOAuth Request:\n"; var_dump($req); exit(1); } |