diff options
author | Brion Vibber <brion@pobox.com> | 2010-05-28 16:52:17 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-05-28 16:52:17 -0700 |
commit | 58fe1a597c76dd6737abbe44e7cb7111d3ae3375 (patch) | |
tree | 6d8ddba5ae17df7f2985fc6acc42d5fa40932607 /plugins/OpenID/openidlogin.php | |
parent | 3ba165cfab7ce30ade64bf557e9c248de2e07029 (diff) |
OpenID: add option to enable asking for a username to append to the trusted provider's base URL. Good for hooking up with sites like WikiHow, where usernames are appended to a base URL to get a profile URL which is used as the provider.
$config['openid']['append_username'] = true;
or check 'Append a username to base URL' in OpenID admin panel.
Diffstat (limited to 'plugins/OpenID/openidlogin.php')
-rw-r--r-- | plugins/OpenID/openidlogin.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/plugins/OpenID/openidlogin.php b/plugins/OpenID/openidlogin.php index 8c559c934..ffedc6481 100644 --- a/plugins/OpenID/openidlogin.php +++ b/plugins/OpenID/openidlogin.php @@ -32,6 +32,9 @@ class OpenidloginAction extends Action $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'); } @@ -94,7 +97,15 @@ class OpenidloginAction extends Action 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() @@ -122,10 +133,17 @@ class OpenidloginAction extends Action $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 { |