// Handle failure status return values.
if (!$auth_request) {
+ common_log(LOG_ERR, __METHOD__ . ": mystery fail contacting $openid_url");
return _m('Not a valid OpenID.');
} else if (Auth_OpenID::isFailure($auth_request)) {
+ common_log(LOG_ERR, __METHOD__ . ": OpenID fail to $openid_url: $auth_request->message");
return sprintf(_m('OpenID failure: %s'), $auth_request->message);
}
);
static $booleans = array(
+ 'openid' => array('append_username'),
'site' => array('openidonly')
);
);
$this->unli();
+ $this->li();
+ $this->out->checkbox(
+ 'append_username', _m('Append a username to base URL'),
+ (bool) $this->value('append_username', 'openid'),
+ _m('Login form will show the base URL and prompt for a username to add at the end. Use when OpenID provider URL should be the profile page for individual users.'),
+ 'true'
+ );
+ $this->unli();
+
$this->li();
$this->input(
'required_team',
$provider = common_config('openid', 'trusted_provider');
if ($provider) {
$openid_url = $provider;
+ if (common_config('openid', 'append_username')) {
+ $openid_url .= $this->trimmed('openid_username');
+ }
} else {
$openid_url = $this->trimmed('openid_url');
}
function showScripts()
{
parent::showScripts();
- $this->autofocus('openid_url');
+ if (common_config('openid', 'trusted_provider')) {
+ if (common_config('openid', 'append_username')) {
+ $this->autofocus('openid_username');
+ } else {
+ $this->autofocus('rememberme');
+ }
+ } else {
+ $this->autofocus('openid_url');
+ }
}
function title()
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
$provider = common_config('openid', 'trusted_provider');
+ $appendUsername = common_config('openid', 'append_username');
if ($provider) {
$this->element('label', array(), _m('OpenID provider'));
$this->element('span', array(), $provider);
+ if ($appendUsername) {
+ $this->element('input', array('id' => 'openid_username',
+ 'name' => 'openid_username',
+ 'style' => 'float: none'));
+ }
$this->element('p', 'form_guide',
+ ($appendUsername ? _m('Enter your username.') . ' ' : '') .
_m('You will be sent to the provider\'s site for authentication.'));
$this->hidden('openid_url', $provider);
} else {