private $fbuser = null; // Facebook user object (JSON)
function prepare($args) {
-
parent::prepare($args);
$this->facebook = new Facebook(
}
if (!empty($this->fbuser)) {
-
// OKAY, all is well... proceed to register
common_debug("Found a valid Facebook user.", __FILE__);
);
$this->clientError(
+ // TRANS: Client error displayed when trying to connect to Facebook while not logged in.
_m('You must be logged into Facebook to register a local account using Facebook.')
);
}
);
$this->clientError(
+ // TRANS: Client error displayed when trying to connect to a Facebook account that is already linked
+ // TRANS: in the same StatusNet site.
_m('There is already a local account linked with that Facebook account.')
);
if (!$token || $token != common_session_token()) {
$this->showForm(
+ // TRANS: Client error displayed when the session token does not match or is not given.
_m('There was a problem with your session token. Try again, please.')
);
return;
if (!$this->boolean('license')) {
$this->showForm(
+ // TRANS: Form validation error displayed when user has not agreed to the license.
_m('You cannot register if you do not agree to the license.'),
$this->trimmed('newname')
);
} else {
$this->showForm(
+ // TRANS: Form validation error displayed when an unhandled error occurs.
_m('An unknown error has occured.'),
$this->trimmed('newname')
);
$this->element(
'div', 'instructions',
- // TRANS: %s is the site name.
sprintf(
+ // TRANS: Form instructions for connecting to Facebook.
+ // TRANS: %s is the site name.
_m('This is the first time you have logged into %s so we must connect your Facebook to a local account. You can either create a new local account, or connect with an existing local account.'),
common_config('site', 'name')
)
}
/**
- * @fixme much of this duplicates core code, which is very fragile.
+ * @todo FIXME: Much of this duplicates core code, which is very fragile.
* Should probably be replaced with an extensible mini version of
* the core registration form.
*/
'class' => 'form_settings',
'action' => common_local_url('facebookfinishlogin')));
$this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options'));
- // TRANS: Legend.
+ // TRANS: Fieldset legend.
$this->element('legend', null, _m('Connection options'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
$this->element('legend', null,
- // TRANS: Legend.
+ // TRANS: Fieldset legend.
_m('Create new account'));
$this->element('p', null,
+ // TRANS: Form instructions.
_m('Create a new user with this nickname.'));
$this->elementStart('ul', 'form_data');
// TRANS: Field label.
$this->input('newname', _m('New nickname'),
($this->username) ? $this->username : '',
+ // TRANS: Field title.
_m('1-64 lowercase letters or numbers, no punctuation or spaces.'));
$this->elementEnd('li');
Event::handle('EndRegistrationFormData', array($this));
$this->elementEnd('ul');
- // TRANS: Submit button.
+ // TRANS: Submit button to create a new account.
$this->submit('create', _m('BUTTON','Create'));
$this->elementEnd('fieldset');
$this->elementStart('fieldset');
- // TRANS: Legend.
$this->element('legend', null,
+ // TRANS: Fieldset legend.
_m('Connect existing account'));
$this->element('p', null,
+ // TRANS: Form instructions.
_m('If you already have an account, login with your username and password to connect it to your Facebook.'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
$this->input('nickname', _m('Existing nickname'));
$this->elementEnd('li');
$this->elementStart('li');
+ // TRANS: Field label.
$this->password('password', _m('Password'));
$this->elementEnd('li');
$this->elementEnd('ul');
- // TRANS: Submit button.
+ // TRANS: Submit button to connect a Facebook account to an existing StatusNet account.
$this->submit('connect', _m('BUTTON','Connect'));
$this->elementEnd('fieldset');
}
if (!User::allowed_nickname($nickname)) {
+ // TRANS: Form validation error displayed when picking a nickname that is not allowed.
$this->showForm(_m('Nickname not allowed.'));
return;
}
if (User::staticGet('nickname', $nickname)) {
+ // TRANS: Form validation error displayed when picking a nickname that is already in use.
$this->showForm(_m('Nickname already in use. Try another one.'));
return;
}
$result = $this->flinkUser($user->id, $this->fbuid);
if (!$result) {
+ // TRANS: Server error displayed when connecting to Facebook fails.
$this->serverError(_m('Error connecting user to Facebook.'));
return;
}
$password = $this->trimmed('password');
if (!common_check_user($nickname, $password)) {
+ // TRANS: Form validation error displayed when username/password combination is incorrect.
$this->showForm(_m('Invalid username or password.'));
return;
}
$result = $this->flinkUser($user->id, $this->fbuid);
if (empty($result)) {
+ // TRANS: Server error displayed when connecting to Facebook fails.
$this->serverError(_m('Error connecting user to Facebook.'));
return;
}
return false;
}
-
}