summaryrefslogtreecommitdiff
path: root/plugins/OpenID
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/OpenID')
-rw-r--r--plugins/OpenID/OpenIDPlugin.php15
-rw-r--r--plugins/OpenID/finishaddopenid.php10
-rw-r--r--plugins/OpenID/finishopenidlogin.php35
-rw-r--r--plugins/OpenID/openid.php15
-rw-r--r--plugins/OpenID/openidlogin.php15
-rw-r--r--plugins/OpenID/openidserver.php6
6 files changed, 83 insertions, 13 deletions
diff --git a/plugins/OpenID/OpenIDPlugin.php b/plugins/OpenID/OpenIDPlugin.php
index 9eac9f6fc..fdcfacfa5 100644
--- a/plugins/OpenID/OpenIDPlugin.php
+++ b/plugins/OpenID/OpenIDPlugin.php
@@ -215,16 +215,16 @@ class OpenIDPlugin extends Plugin
if (common_config('site', 'openidonly') && !common_logged_in()) {
// TRANS: Tooltip for main menu option "Login"
$tooltip = _m('TOOLTIP', 'Login to the site');
- // TRANS: Main menu option when not logged in to log in
$action->menuItem(common_local_url('openidlogin'),
+ // TRANS: Main menu option when not logged in to log in
_m('MENU', 'Login'),
$tooltip,
false,
'nav_login');
// TRANS: Tooltip for main menu option "Help"
$tooltip = _m('TOOLTIP', 'Help me!');
- // TRANS: Main menu option for help on the StatusNet site
$action->menuItem(common_local_url('doc', array('title' => 'help')),
+ // TRANS: Main menu option for help on the StatusNet site
_m('MENU', 'Help'),
$tooltip,
false,
@@ -232,8 +232,8 @@ class OpenIDPlugin extends Plugin
if (!common_config('site', 'private')) {
// TRANS: Tooltip for main menu option "Search"
$tooltip = _m('TOOLTIP', 'Search for people or text');
- // TRANS: Main menu option when logged in or when the StatusNet instance is not private
$action->menuItem(common_local_url('peoplesearch'),
+ // TRANS: Main menu option when logged in or when the StatusNet instance is not private
_m('MENU', 'Search'), $tooltip, false, 'nav_search');
}
Event::handle('EndPrimaryNav', array($action));
@@ -293,7 +293,9 @@ class OpenIDPlugin extends Plugin
$action_name = $action->trimmed('action');
$action->menuItem(common_local_url('openidlogin'),
- _m('OpenID'),
+ // TRANS: OpenID plugin menu item on site logon page.
+ _m('MENU', 'OpenID'),
+ // TRANS: OpenID plugin tooltip for logon menu item.
_m('Login or register with OpenID'),
$action_name === 'openidlogin');
}
@@ -329,7 +331,9 @@ class OpenIDPlugin extends Plugin
$action_name = $action->trimmed('action');
$action->menuItem(common_local_url('openidsettings'),
- _m('OpenID'),
+ // TRANS: OpenID plugin menu item on user settings page.
+ _m('MENU', 'OpenID'),
+ // TRANS: OpenID plugin tooltip for user settings menu item.
_m('Add or remove OpenIDs'),
$action_name === 'openidsettings');
@@ -637,6 +641,7 @@ class OpenIDPlugin extends Plugin
'author' => 'Evan Prodromou, Craig Andrews',
'homepage' => 'http://status.net/wiki/Plugin:OpenID',
'rawdescription' =>
+ // TRANS: OpenID plugin description.
_m('Use <a href="http://openid.net/">OpenID</a> to login to the site.'));
return true;
}
diff --git a/plugins/OpenID/finishaddopenid.php b/plugins/OpenID/finishaddopenid.php
index 064e97642..47b3f7fb1 100644
--- a/plugins/OpenID/finishaddopenid.php
+++ b/plugins/OpenID/finishaddopenid.php
@@ -64,6 +64,7 @@ class FinishaddopenidAction extends Action
{
parent::handle($args);
if (!common_logged_in()) {
+ // TRANS: Client error message
$this->clientError(_m('Not logged in.'));
} else {
$this->tryLogin();
@@ -85,10 +86,12 @@ class FinishaddopenidAction extends Action
$response = $consumer->complete(common_local_url('finishaddopenid'));
if ($response->status == Auth_OpenID_CANCEL) {
+ // TRANS: Status message in case the response from the OpenID provider is that the logon attempt was cancelled.
$this->message(_m('OpenID authentication cancelled.'));
return;
} else if ($response->status == Auth_OpenID_FAILURE) {
- // Authentication failed; display the error message.
+ // TRANS: OpenID authentication failed; display the error message.
+ // TRANS: %s is the error message.
$this->message(sprintf(_m('OpenID authentication failed: %s'),
$response->message));
} else if ($response->status == Auth_OpenID_SUCCESS) {
@@ -115,8 +118,10 @@ class FinishaddopenidAction extends Action
if ($other) {
if ($other->id == $cur->id) {
+ // TRANS: message in case a user tries to add an OpenID that is already connected to them.
$this->message(_m('You already have this OpenID!'));
} else {
+ // TRANS: message in case a user tries to add an OpenID that is already used by another user.
$this->message(_m('Someone else already has this OpenID.'));
}
return;
@@ -129,12 +134,14 @@ class FinishaddopenidAction extends Action
$result = oid_link_user($cur->id, $canonical, $display);
if (!$result) {
+ // TRANS: message in case the OpenID object cannot be connected to the user.
$this->message(_m('Error connecting user.'));
return;
}
if (Event::handle('StartOpenIDUpdateUser', array($cur, $canonical, &$sreg))) {
if ($sreg) {
if (!oid_update_user($cur, $sreg)) {
+ // TRANS: message in case the user or the user profile cannot be saved in StatusNet.
$this->message(_m('Error updating profile'));
return;
}
@@ -176,6 +183,7 @@ class FinishaddopenidAction extends Action
function title()
{
+ // TRANS: Title after getting the status of the OpenID authorisation request.
return _m('OpenID Login');
}
diff --git a/plugins/OpenID/finishopenidlogin.php b/plugins/OpenID/finishopenidlogin.php
index 415fd8e66..0c03b5c4d 100644
--- a/plugins/OpenID/finishopenidlogin.php
+++ b/plugins/OpenID/finishopenidlogin.php
@@ -31,15 +31,18 @@ class FinishopenidloginAction extends Action
{
parent::handle($args);
if (common_is_real_login()) {
+ // TRANS: Client error message trying to log on with OpenID while already logged on.
$this->clientError(_m('Already logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
+ // TRANS: Message given when there is a problem with the user's session token.
$this->showForm(_m('There was a problem with your session token. Try again, please.'));
return;
}
if ($this->arg('create')) {
if (!$this->boolean('license')) {
+ // TRANS: Message given if user does not agree with the site's license.
$this->showForm(_m('You can\'t register if you don\'t agree to the license.'),
$this->trimmed('newname'));
return;
@@ -48,7 +51,8 @@ class FinishopenidloginAction extends Action
} else if ($this->arg('connect')) {
$this->connectUser();
} else {
- $this->showForm(_m('Something weird happened.'),
+ // TRANS: Messag given on an unknown error.
+ $this->showForm(_m('An unknown error has occured.'),
$this->trimmed('newname'));
}
} else {
@@ -62,12 +66,15 @@ class FinishopenidloginAction extends Action
$this->element('div', array('class' => 'error'), $this->error);
} else {
$this->element('div', 'instructions',
+ // TRANS: Instructions given after a first successful logon using OpenID.
+ // TRANS: %s is the site name.
sprintf(_m('This is the first time you\'ve logged into %s so we must connect your OpenID to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name')));
}
}
function title()
{
+ // TRANS: Title
return _m('OpenID Account Setup');
}
@@ -115,6 +122,8 @@ class FinishopenidloginAction extends Action
'value' => 'true'));
$this->elementStart('label', array('for' => 'license',
'class' => 'checkbox'));
+ // TRANS: OpenID plugin link text.
+ // TRANS: %s is a link to a licese with the license name as link text.
$message = _('My text and files are available under %s ' .
'except this private data: password, ' .
'email address, IM address, and phone number.');
@@ -127,23 +136,29 @@ class FinishopenidloginAction extends Action
$this->elementEnd('label');
$this->elementEnd('li');
$this->elementEnd('ul');
- $this->submit('create', _m('Create'));
+ // TRANS: Button label in form in which to create a new user on the site for an OpenID.
+ $this->submit('create', _m('BUTTON', 'Create'));
$this->elementEnd('fieldset');
$this->elementStart('fieldset', array('id' => 'form_openid_createaccount'));
$this->element('legend', null,
+ // TRANS: Used as form legend for form in which to connect an OpenID to an existing user on the site.
_m('Connect existing account'));
$this->element('p', null,
+ // TRANS: User instructions for form in which to connect an OpenID to an existing user on the site.
_m('If you already have an account, login with your username and password to connect it to your OpenID.'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
+ // TRANS: Field label in form in which to connect an OpenID to an existing user on the site.
$this->input('nickname', _m('Existing nickname'));
$this->elementEnd('li');
$this->elementStart('li');
+ // TRANS: Field label in form in which to connect an OpenID to an existing user on the site.
$this->password('password', _m('Password'));
$this->elementEnd('li');
$this->elementEnd('ul');
- $this->submit('connect', _m('Connect'));
+ // TRANS: Button label in form in which to connect an OpenID to an existing user on the site.
+ $this->submit('connect', _m('BUTTON', 'Connect'));
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
@@ -155,10 +170,11 @@ class FinishopenidloginAction extends Action
$response = $consumer->complete(common_local_url('finishopenidlogin'));
if ($response->status == Auth_OpenID_CANCEL) {
+ // TRANS: Status message in case the response from the OpenID provider is that the logon attempt was cancelled.
$this->message(_m('OpenID authentication cancelled.'));
return;
} else if ($response->status == Auth_OpenID_FAILURE) {
- // Authentication failed; display the error message.
+ // TRANS: OpenID authentication failed; display the error message. %s is the error message.
$this->message(sprintf(_m('OpenID authentication failed: %s'), $response->message));
} else if ($response->status == Auth_OpenID_SUCCESS) {
// This means the authentication succeeded; extract the
@@ -230,6 +246,7 @@ class FinishopenidloginAction extends Action
# FIXME: save invite code before redirect, and check here
if (common_config('site', 'closed')) {
+ // TRANS: OpenID plugin message. No new user registration is allowed on the site.
$this->clientError(_m('Registration not allowed.'));
return;
}
@@ -239,6 +256,7 @@ class FinishopenidloginAction extends Action
if (common_config('site', 'inviteonly')) {
$code = $_SESSION['invitecode'];
if (empty($code)) {
+ // TRANS: OpenID plugin message. No new user registration is allowed on the site without an invitation code, and none was provided.
$this->clientError(_m('Registration not allowed.'));
return;
}
@@ -246,6 +264,7 @@ class FinishopenidloginAction extends Action
$invite = Invitation::staticGet($code);
if (empty($invite)) {
+ // TRANS: OpenID plugin message. No new user registration is allowed on the site without an invitation code, and the one provided was not valid.
$this->clientError(_m('Not a valid invitation code.'));
return;
}
@@ -256,16 +275,19 @@ class FinishopenidloginAction extends Action
if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,
'format' => NICKNAME_FMT))) {
+ // TRANS: OpenID plugin message. The entered new user name did not conform to the requirements.
$this->showForm(_m('Nickname must have only lowercase letters and numbers and no spaces.'));
return;
}
if (!User::allowed_nickname($nickname)) {
+ // TRANS: OpenID plugin message. The entered new user name is blacklisted.
$this->showForm(_m('Nickname not allowed.'));
return;
}
if (User::staticGet('nickname', $nickname)) {
+ // TRANS: OpenID plugin message. The entered new user name is already used.
$this->showForm(_m('Nickname already in use. Try another one.'));
return;
}
@@ -273,6 +295,7 @@ class FinishopenidloginAction extends Action
list($display, $canonical, $sreg) = $this->getSavedValues();
if (!$display || !$canonical) {
+ // TRANS: OpenID plugin server error. A stored OpenID cannot be retrieved.
$this->serverError(_m('Stored OpenID not found.'));
return;
}
@@ -282,6 +305,7 @@ class FinishopenidloginAction extends Action
$other = oid_get_user($canonical);
if ($other) {
+ // TRANS: OpenID plugin server error.
$this->serverError(_m('Creating new account for OpenID that already has a user.'));
return;
}
@@ -346,6 +370,7 @@ class FinishopenidloginAction extends Action
$password = $this->trimmed('password');
if (!common_check_user($nickname, $password)) {
+ // TRANS: OpenID plugin message.
$this->showForm(_m('Invalid username or password.'));
return;
}
@@ -357,6 +382,7 @@ class FinishopenidloginAction extends Action
list($display, $canonical, $sreg) = $this->getSavedValues();
if (!$display || !$canonical) {
+ // TRANS: OpenID plugin server error. A stored OpenID cannot be found.
$this->serverError(_m('Stored OpenID not found.'));
return;
}
@@ -364,6 +390,7 @@ class FinishopenidloginAction extends Action
$result = oid_link_user($user->id, $canonical, $display);
if (!$result) {
+ // TRANS: OpenID plugin server error. The user or user profile could not be saved.
$this->serverError(_m('Error connecting user to OpenID.'));
return;
}
diff --git a/plugins/OpenID/openid.php b/plugins/OpenID/openid.php
index 574ecca72..68851f4eb 100644
--- a/plugins/OpenID/openid.php
+++ b/plugins/OpenID/openid.php
@@ -134,6 +134,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false)
$consumer = oid_consumer();
if (!$consumer) {
+ // TRANS: OpenID plugin server error.
common_server_error(_m('Cannot instantiate OpenID consumer object.'));
return false;
}
@@ -144,8 +145,11 @@ function oid_authenticate($openid_url, $returnto, $immediate=false)
// Handle failure status return values.
if (!$auth_request) {
+ // TRANS: OpenID plugin message. Given when an OpenID is not valid.
return _m('Not a valid OpenID.');
} else if (Auth_OpenID::isFailure($auth_request)) {
+ // TRANS: OpenID plugin server error. Given when the OpenID authentication request fails.
+ // TRANS: %s is the failure message.
return sprintf(_m('OpenID failure: %s'), $auth_request->message);
}
@@ -182,6 +186,8 @@ function oid_authenticate($openid_url, $returnto, $immediate=false)
$immediate);
if (!$redirect_url) {
} else if (Auth_OpenID::isFailure($redirect_url)) {
+ // TRANS: OpenID plugin server error. Given when the OpenID authentication request cannot be redirected.
+ // TRANS: %s is the failure message.
return sprintf(_m('Could not redirect to server: %s'), $redirect_url->message);
} else {
common_redirect($redirect_url, 303);
@@ -200,6 +206,8 @@ function oid_authenticate($openid_url, $returnto, $immediate=false)
// Display an error if the form markup couldn't be generated;
// otherwise, render the HTML.
if (Auth_OpenID::isFailure($form_html)) {
+ // TRANS: OpenID plugin server error if the form markup could not be generated.
+ // TRANS: %s is the failure message.
common_server_error(sprintf(_m('Could not create OpenID form: %s'), $form_html->message));
} else {
$action = new AutosubmitAction(); // see below
@@ -216,6 +224,7 @@ function oid_authenticate($openid_url, $returnto, $immediate=false)
function _oid_print_instructions()
{
common_element('div', 'instructions',
+ // TRANS: OpenID plugin user instructions.
_m('This form should automatically submit itself. '.
'If not, click the submit button to go to your '.
'OpenID provider.'));
@@ -251,6 +260,7 @@ function oid_update_user($user, $sreg)
# XXX save timezone if it's passed
if (!$profile->update($orig_profile)) {
+ // TRANS: OpenID plugin server error.
common_server_error(_m('Error saving the profile.'));
return false;
}
@@ -262,6 +272,7 @@ function oid_update_user($user, $sreg)
}
if (!$user->update($orig_user)) {
+ // TRANS: OpenID plugin server error.
common_server_error(_m('Error saving the user.'));
return false;
}
@@ -291,6 +302,7 @@ function oid_assert_allowed($url)
return;
}
}
+ // TRANS: OpenID plugin client exception (403).
throw new ClientException(_m("Unauthorized URL used for OpenID login."), 403);
}
}
@@ -338,6 +350,7 @@ class AutosubmitAction extends Action
function title()
{
+ // TRANS: Title
return _m('OpenID Login Submission');
}
@@ -348,9 +361,11 @@ class AutosubmitAction extends Action
$this->element('img', array('src' => Theme::path('images/icons/icon_processing.gif', 'base'),
// for some reason the base CSS sets <img>s as block display?!
'style' => 'display: inline'));
+ // TRANS: OpenID plugin message used while requesting authorization user's OpenID login provider.
$this->text(_m('Requesting authorization from your login provider...'));
$this->raw('</p>');
$this->raw('<p style="margin-top: 60px; font-style: italic">');
+ // TRANS: OpenID plugin message. User instruction while requesting authorization user's OpenID login provider.
$this->text(_m('If you are not redirected to your login provider in a few seconds, try pushing the button below.'));
$this->raw('</p>');
$this->raw($this->form_html);
diff --git a/plugins/OpenID/openidlogin.php b/plugins/OpenID/openidlogin.php
index 8c559c934..34e00ccce 100644
--- a/plugins/OpenID/openidlogin.php
+++ b/plugins/OpenID/openidlogin.php
@@ -27,6 +27,7 @@ class OpenidloginAction extends Action
{
parent::handle($args);
if (common_is_real_login()) {
+ // TRANS: Client error message trying to log on with OpenID while already logged on.
$this->clientError(_m('Already logged in.'));
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$provider = common_config('openid', 'trusted_provider');
@@ -41,6 +42,7 @@ class OpenidloginAction extends Action
# CSRF protection
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
+ // TRANS: Message given when there is a problem with the user's session token.
$this->showForm(_m('There was a problem with your session token. Try again, please.'), $openid_url);
return;
}
@@ -70,10 +72,14 @@ class OpenidloginAction extends Action
common_get_returnto()) {
// rememberme logins have to reauthenticate before
// changing any profile settings (cookie-stealing protection)
+ // TRANS: OpenID plugin message. Rememberme logins have to reauthenticate before changing any profile settings.
+ // TRANS: "OpenID" is the display text for a link with URL "(%%doc.openid%%)".
return _m('For security reasons, please re-login with your ' .
'[OpenID](%%doc.openid%%) ' .
'before changing your settings.');
} else {
+ // TRANS: OpenID plugin message.
+ // TRANS: "OpenID" is the display text for a link with URL "(%%doc.openid%%)".
return _m('Login with an [OpenID](%%doc.openid%%) account.');
}
}
@@ -99,6 +105,7 @@ class OpenidloginAction extends Action
function title()
{
+ // TRANS: OpenID plugin message. Title.
return _m('OpenID Login');
}
@@ -116,6 +123,7 @@ class OpenidloginAction extends Action
'class' => 'form_settings',
'action' => $formaction));
$this->elementStart('fieldset');
+ // TRANS: OpenID plugin logon form legend.
$this->element('legend', null, _m('OpenID login'));
$this->hidden('token', common_session_token());
@@ -129,18 +137,23 @@ class OpenidloginAction extends Action
_m('You will be sent to the provider\'s site for authentication.'));
$this->hidden('openid_url', $provider);
} else {
+ // TRANS: OpenID plugin logon form field label.
$this->input('openid_url', _m('OpenID URL'),
$this->openid_url,
+ // TRANS: OpenID plugin logon form field instructions.
_m('Your OpenID URL'));
}
$this->elementEnd('li');
$this->elementStart('li', array('id' => 'settings_rememberme'));
+ // TRANS: OpenID plugin logon form checkbox label for setting to put the OpenID information in a cookie.
$this->checkbox('rememberme', _m('Remember me'), false,
+ // TRANS: OpenID plugin logon form field instructions.
_m('Automatically login in the future; ' .
'not for shared computers!'));
$this->elementEnd('li');
$this->elementEnd('ul');
- $this->submit('submit', _m('Login'));
+ // TRANS: OpenID plugin logon form button label to start logon with the data provided in the logon form.
+ $this->submit('submit', _m('BUTTON', 'Login'));
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
diff --git a/plugins/OpenID/openidserver.php b/plugins/OpenID/openidserver.php
index afbca553f..f7e3a45f2 100644
--- a/plugins/OpenID/openidserver.php
+++ b/plugins/OpenID/openidserver.php
@@ -71,7 +71,7 @@ class OpenidserverAction extends Action
}else{
/* Go log in, and then come back. */
common_set_returnto($_SERVER['REQUEST_URI']);
- common_redirect(common_local_url('login'));
+ common_redirect(common_local_url('login'), 303);
return;
}
}else if(common_profile_url($user->nickname) == $request->identity || $request->idSelect()){
@@ -91,7 +91,7 @@ class OpenidserverAction extends Action
$_SESSION['openid_allow_url'] = $allowResponse->encodeToUrl();
$_SESSION['openid_deny_url'] = $denyResponse->encodeToUrl();
//ask the user to trust this trust root
- common_redirect(common_local_url('openidtrust'));
+ common_redirect(common_local_url('openidtrust'), 303);
return;
}
}else{
@@ -103,6 +103,7 @@ class OpenidserverAction extends Action
$response = $this->generateDenyResponse($request);
} else {
//invalid
+ // TRANS: OpenID plugin client error given trying to add an unauthorised OpenID to a user (403).
$this->clientError(sprintf(_m('You are not authorized to use the identity %s.'),$request->identity),$code=403);
}
} else {
@@ -123,6 +124,7 @@ class OpenidserverAction extends Action
}
$this->raw($response->body);
}else{
+ // TRANS: OpenID plugin client error given when not getting a response for a given OpenID provider (500).
$this->clientError(_m('Just an OpenID provider. Nothing to see here, move along...'),$code=500);
}
}