Make the verifier pin display a little nicer
This commit is contained in:
parent
82a0a1a74b
commit
b8f2cc4e6f
@ -449,21 +449,28 @@ class ApiOauthAuthorizeAction extends Action
|
|||||||
|
|
||||||
function showAuthorized()
|
function showAuthorized()
|
||||||
{
|
{
|
||||||
|
$title = sprintf(
|
||||||
|
_("You have successfully authorized %s."),
|
||||||
|
$this->app->name
|
||||||
|
);
|
||||||
|
|
||||||
|
$msg = sprintf(
|
||||||
|
_('Please return to %s and enter the following security code to complete the process.'),
|
||||||
|
$this->app->name
|
||||||
|
);
|
||||||
|
|
||||||
if ($this->reqToken->verified_callback == 'oob') {
|
if ($this->reqToken->verified_callback == 'oob') {
|
||||||
|
$pin = new ApiOauthPinAction($title, $msg, $this->reqToken->verifier);
|
||||||
$pin = new ApiOauthPinAction($this->reqToken->verifier);
|
|
||||||
$pin->showPage();
|
$pin->showPage();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
// NOTE: This should probably never happen; trhow an error instead?
|
||||||
|
|
||||||
$info = new InfoAction(
|
$info = new InfoAction(
|
||||||
_("Authorization succeeded."),
|
$title,
|
||||||
sprintf(
|
$msg,
|
||||||
_('The request token %s has been authorized. Please exchange it for an access token using this verifier: %s'),
|
$this->oauthTokenParam,
|
||||||
$this->oauthTokenParam,
|
$this->reqToken->verifier
|
||||||
$this->reqToken->verifier
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$info->showPage();
|
$info->showPage();
|
||||||
|
@ -36,6 +36,8 @@ require_once INSTALLDIR . '/lib/info.php';
|
|||||||
/**
|
/**
|
||||||
* Class for displaying an OAuth verifier pin
|
* 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
|
* @category Action
|
||||||
* @package StatusNet
|
* @package StatusNet
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
@ -45,16 +47,13 @@ require_once INSTALLDIR . '/lib/info.php';
|
|||||||
|
|
||||||
class ApiOauthPinAction extends InfoAction
|
class ApiOauthPinAction extends InfoAction
|
||||||
{
|
{
|
||||||
|
function __construct($title, $message, $verifier)
|
||||||
function __construct($verifier)
|
|
||||||
{
|
{
|
||||||
$this->verifier = $verifier;
|
$this->verifier = $verifier;
|
||||||
$title = _('Authorization succeeded.');
|
$this->title = $title;
|
||||||
parent::__construct($title, $title);
|
parent::__construct($title, $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check for logged in state!
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display content.
|
* Display content.
|
||||||
*
|
*
|
||||||
@ -62,8 +61,7 @@ class ApiOauthPinAction extends InfoAction
|
|||||||
*/
|
*/
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
// XXX: make this much nicer
|
$this->element('div', array('class' => 'info'), $this->message);
|
||||||
$this->element('div', array('class' => 'info'), $this->verifier);
|
$this->element('div', array('id' => 'oauth_pin'), $this->verifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ try {
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// oh noez
|
// oh noez
|
||||||
print $e->getMessage();
|
print $e->getMessage();
|
||||||
print "OAuth Request:\n";
|
print "\nOAuth Request:\n";
|
||||||
var_dump($req);
|
var_dump($req);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user