mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Reasonable pht pass at auth.
Summary: Spent some time going through auth stuff for pht's. Test Plan: Tested logging in, logging out, reseting password, using Github, creating a new account. I couldn't quite test everything so will double read the diff when I submit it. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4671
This commit is contained in:
parent
5cb8787d91
commit
251a7b0602
15 changed files with 199 additions and 174 deletions
|
@ -5,7 +5,7 @@ abstract class PhabricatorAuthController extends PhabricatorController {
|
|||
public function buildStandardPageResponse($view, array $data) {
|
||||
$page = $this->buildStandardPageView();
|
||||
|
||||
$page->setApplicationName('Login');
|
||||
$page->setApplicationName(pht('Login'));
|
||||
$page->setBaseURI('/login/');
|
||||
$page->setTitle(idx($data, 'title'));
|
||||
$page->appendChild($view);
|
||||
|
|
|
@ -15,13 +15,14 @@ final class PhabricatorDisabledUserController
|
|||
}
|
||||
|
||||
$failure_view = new AphrontRequestFailureView();
|
||||
$failure_view->setHeader('Account Disabled');
|
||||
$failure_view->appendChild('<p>Your account has been disabled.</p>');
|
||||
$failure_view->setHeader(pht('Account Disabled'));
|
||||
$failure_view->appendChild(
|
||||
'<p>'.pht('Your account has been disabled.').'</p>');
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$failure_view,
|
||||
array(
|
||||
'title' => 'Account Disabled',
|
||||
'title' => pht('Account Disabled'),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,18 +22,18 @@ final class PhabricatorEmailLoginController
|
|||
|
||||
if ($request->isFormPost()) {
|
||||
$e_email = null;
|
||||
$e_captcha = 'Again';
|
||||
$e_captcha = pht('Again');
|
||||
|
||||
$captcha_ok = AphrontFormRecaptchaControl::processCaptcha($request);
|
||||
if (!$captcha_ok) {
|
||||
$errors[] = "Captcha response is incorrect, try again.";
|
||||
$e_captcha = 'Invalid';
|
||||
$errors[] = pht("Captcha response is incorrect, try again.");
|
||||
$e_captcha = pht('Invalid');
|
||||
}
|
||||
|
||||
$email = $request->getStr('email');
|
||||
if (!strlen($email)) {
|
||||
$errors[] = "You must provide an email address.";
|
||||
$e_email = 'Required';
|
||||
$errors[] = pht("You must provide an email address.");
|
||||
$e_email = pht('Required');
|
||||
}
|
||||
|
||||
if (!$errors) {
|
||||
|
@ -53,8 +53,9 @@ final class PhabricatorEmailLoginController
|
|||
}
|
||||
|
||||
if (!$target_user) {
|
||||
$errors[] = "There is no account associated with that email address.";
|
||||
$e_email = "Invalid";
|
||||
$errors[] =
|
||||
pht("There is no account associated with that email address.");
|
||||
$e_email = pht("Invalid");
|
||||
}
|
||||
|
||||
if (!$errors) {
|
||||
|
@ -96,13 +97,15 @@ EOBODY;
|
|||
$mail->saveAndSend();
|
||||
|
||||
$view = new AphrontRequestFailureView();
|
||||
$view->setHeader('Check Your Email');
|
||||
$view->setHeader(pht('Check Your Email'));
|
||||
$view->appendChild(
|
||||
'<p>An email has been sent with a link you can use to login.</p>');
|
||||
'<p>'.pht(
|
||||
'An email has been sent with a link you can use to login.'
|
||||
).'</p>');
|
||||
return $this->buildStandardPageResponse(
|
||||
$view,
|
||||
array(
|
||||
'title' => 'Email Sent',
|
||||
'title' => pht('Email Sent'),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -115,38 +118,41 @@ EOBODY;
|
|||
->setUser($request->getUser())
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Email')
|
||||
->setLabel(pht('Email'))
|
||||
->setName('email')
|
||||
->setValue($request->getStr('email'))
|
||||
->setError($e_email))
|
||||
->appendChild(
|
||||
id(new AphrontFormRecaptchaControl())
|
||||
->setLabel('Captcha')
|
||||
->setLabel(pht('Captcha'))
|
||||
->setError($e_captcha))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Send Email'));
|
||||
->setValue(pht('Send Email')));
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle('Login Error');
|
||||
$error_view->setTitle(pht('Login Error'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
$panel->appendChild('<h1>Forgot Password / Email Login</h1>');
|
||||
$panel->appendChild('
|
||||
<h1>'.pht('Forgot Password / Email Login').'</h1>');
|
||||
$panel->appendChild($email_auth);
|
||||
$panel->setNoBackground();
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$error_view,
|
||||
$panel,
|
||||
),
|
||||
array(
|
||||
'title' => 'Create New Account',
|
||||
'title' => pht('Forgot Password'),
|
||||
'device' => true,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -49,21 +49,23 @@ final class PhabricatorEmailTokenController
|
|||
!$target_user->validateEmailToken($target_email, $token)) {
|
||||
|
||||
$view = new AphrontRequestFailureView();
|
||||
$view->setHeader('Unable to Login');
|
||||
$view->setHeader(pht('Unable to Login'));
|
||||
$view->appendChild(
|
||||
'<p>The authentication information in the link you clicked is '.
|
||||
'<p>'.pht('The authentication information in the link you clicked is '.
|
||||
'invalid or out of date. Make sure you are copy-and-pasting the '.
|
||||
'entire link into your browser. You can try again, or request '.
|
||||
'a new email.</p>');
|
||||
'a new email.').'</p>');
|
||||
$view->appendChild(
|
||||
'<div class="aphront-failure-continue">'.
|
||||
'<a class="button" href="/login/email/">Send Another Email</a>'.
|
||||
'<a class="button" href="/login/email/">'.
|
||||
pht('Send Another Email').
|
||||
'</a>'.
|
||||
'</div>');
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$view,
|
||||
array(
|
||||
'title' => 'Login Failure',
|
||||
'title' => pht('Login Failure'),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -42,11 +42,12 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
|
|||
$existing_ldap) {
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($current_user);
|
||||
$dialog->setTitle('Already Linked to Another Account');
|
||||
$dialog->setTitle(pht('Already Linked to Another Account'));
|
||||
$dialog->appendChild(
|
||||
'<p>The LDAP account you just authorized is already linked to '.
|
||||
'another Phabricator account. Before you can link it to a '.
|
||||
'different LDAP account, you must unlink the old account.</p>'
|
||||
'<p>'.pht('The LDAP account you just authorized is already '.
|
||||
'linked toanother Phabricator account. Before you can link it '.
|
||||
'to a different LDAP account, you must unlink the old '.
|
||||
'account.').'</p>'
|
||||
);
|
||||
$dialog->addCancelButton('/settings/panel/ldap/');
|
||||
|
||||
|
@ -60,12 +61,14 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
|
|||
if (!$request->isDialogFormPost()) {
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($current_user);
|
||||
$dialog->setTitle('Link LDAP Account');
|
||||
$dialog->setTitle(pht('Link LDAP Account'));
|
||||
$dialog->appendChild(
|
||||
'<p>Link your LDAP account to your Phabricator account?</p>');
|
||||
'<p>'.
|
||||
pht('Link your LDAP account to your Phabricator account?').
|
||||
'</p>');
|
||||
$dialog->addHiddenInput('username', $request->getStr('username'));
|
||||
$dialog->addHiddenInput('password', $request->getStr('password'));
|
||||
$dialog->addSubmitButton('Link Accounts');
|
||||
$dialog->addSubmitButton(pht('Link Accounts'));
|
||||
$dialog->addCancelButton('/settings/panel/ldap/');
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
|
@ -116,27 +119,27 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
|
|||
->setAction('/ldap/login/')
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('LDAP username')
|
||||
->setLabel(pht('LDAP username'))
|
||||
->setName('username')
|
||||
->setValue($ldap_username))
|
||||
->appendChild(
|
||||
id(new AphrontFormPasswordControl())
|
||||
->setLabel('Password')
|
||||
->setLabel(pht('Password'))
|
||||
->setName('password'));
|
||||
|
||||
$ldap_form
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Login'));
|
||||
->setValue(pht('Login')));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
$panel->appendChild('<h1>LDAP login</h1>');
|
||||
$panel->appendChild('<h1>'.pht('LDAP login').'</h1>');
|
||||
$panel->appendChild($ldap_form);
|
||||
|
||||
if (isset($errors) && count($errors) > 0) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle('Login Failed');
|
||||
$error_view->setTitle(pht('Login Failed'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
|
@ -146,7 +149,7 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
|
|||
$panel,
|
||||
),
|
||||
array(
|
||||
'title' => 'Login',
|
||||
'title' => pht('Login'),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -63,10 +63,10 @@ extends PhabricatorAuthController {
|
|||
$user->setUsername($request->getStr('username'));
|
||||
$username = $user->getUsername();
|
||||
if (!strlen($user->getUsername())) {
|
||||
$e_username = 'Required';
|
||||
$errors[] = 'Username is required.';
|
||||
$e_username = pht('Required');
|
||||
$errors[] = pht('Username is required.');
|
||||
} else if (!PhabricatorUser::validateUsername($username)) {
|
||||
$e_username = 'Invalid';
|
||||
$e_username = pht('Invalid');
|
||||
$errors[] = PhabricatorUser::describeValidUsername();
|
||||
} else {
|
||||
$e_username = null;
|
||||
|
@ -75,8 +75,8 @@ extends PhabricatorAuthController {
|
|||
if (!$new_email) {
|
||||
$new_email = trim($request->getStr('email'));
|
||||
if (!$new_email) {
|
||||
$e_email = 'Required';
|
||||
$errors[] = 'Email is required.';
|
||||
$e_email = pht('Required');
|
||||
$errors[] = pht('Email is required.');
|
||||
} else {
|
||||
$e_email = null;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ extends PhabricatorAuthController {
|
|||
|
||||
if ($new_email) {
|
||||
if (!PhabricatorUserEmail::isAllowedAddress($new_email)) {
|
||||
$e_email = 'Invalid';
|
||||
$e_email = pht('Invalid');
|
||||
$errors[] = PhabricatorUserEmail::describeAllowedAddresses();
|
||||
}
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ extends PhabricatorAuthController {
|
|||
if (!strlen($user->getRealName())) {
|
||||
$user->setRealName($request->getStr('realname'));
|
||||
if (!strlen($user->getRealName())) {
|
||||
$e_realname = 'Required';
|
||||
$errors[] = 'Real name is required.';
|
||||
$e_realname = pht('Required');
|
||||
$errors[] = pht('Real name is required.');
|
||||
} else {
|
||||
$e_realname = null;
|
||||
}
|
||||
|
@ -137,11 +137,11 @@ extends PhabricatorAuthController {
|
|||
$new_email);
|
||||
|
||||
if ($same_username) {
|
||||
$e_username = 'Duplicate';
|
||||
$errors[] = 'That username or email is not unique.';
|
||||
$e_username = pht('Duplicate');
|
||||
$errors[] = pht('That username or email is not unique.');
|
||||
} else if ($same_email) {
|
||||
$e_email = 'Duplicate';
|
||||
$errors[] = 'That email is not unique.';
|
||||
$e_email = pht('Duplicate');
|
||||
$errors[] = pht('That email is not unique.');
|
||||
} else {
|
||||
throw $exception;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ extends PhabricatorAuthController {
|
|||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle('Registration Failed');
|
||||
$error_view->setTitle(pht('Registration Failed'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
|
@ -169,20 +169,20 @@ extends PhabricatorAuthController {
|
|||
->setAction($action_path)
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Username')
|
||||
->setLabel(pht('Username'))
|
||||
->setName('username')
|
||||
->setValue($user->getUsername())
|
||||
->setError($e_username));
|
||||
|
||||
$form->appendChild(
|
||||
id(new AphrontFormPasswordControl())
|
||||
->setLabel('Password')
|
||||
->setLabel(pht('Password'))
|
||||
->setName('password'));
|
||||
|
||||
if ($show_email_input) {
|
||||
$form->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Email')
|
||||
->setLabel(pht('Email'))
|
||||
->setName('email')
|
||||
->setValue($request->getStr('email'))
|
||||
->setError($e_email));
|
||||
|
@ -191,7 +191,7 @@ extends PhabricatorAuthController {
|
|||
if ($provider->retrieveUserRealName() === null) {
|
||||
$form->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Real Name')
|
||||
->setLabel(pht('Real Name'))
|
||||
->setName('realname')
|
||||
->setValue($request->getStr('realname'))
|
||||
->setError($e_realname));
|
||||
|
@ -200,10 +200,10 @@ extends PhabricatorAuthController {
|
|||
$form
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Create Account'));
|
||||
->setValue(pht('Create Account')));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('Create New Account');
|
||||
$panel->setHeader(pht('Create New Account'));
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
$panel->appendChild($form);
|
||||
|
||||
|
@ -213,7 +213,7 @@ extends PhabricatorAuthController {
|
|||
$panel,
|
||||
),
|
||||
array(
|
||||
'title' => 'Create New Account',
|
||||
'title' => pht('Create New Account'),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,11 +17,11 @@ final class PhabricatorLDAPUnlinkController extends PhabricatorAuthController {
|
|||
if (!$request->isDialogFormPost()) {
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($user);
|
||||
$dialog->setTitle('Really unlink account?');
|
||||
$dialog->setTitle(pht('Really unlink account?'));
|
||||
$dialog->appendChild(
|
||||
'<p><strong>You will not be able to login</strong> using this account '.
|
||||
'once you unlink it. Continue?</p>');
|
||||
$dialog->addSubmitButton('Unlink Account');
|
||||
'<p>'.pht('You will not be able to login using this account '.
|
||||
'once you unlink it. Continue?').'</p>');
|
||||
$dialog->addSubmitButton(pht('Unlink Account'));
|
||||
$dialog->addCancelButton('/settings/panel/ldap/');
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
|
|
|
@ -28,10 +28,10 @@ final class PhabricatorLoginController
|
|||
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($user);
|
||||
$dialog->setTitle('Login Required');
|
||||
$dialog->appendChild('<p>You must login to continue.</p>');
|
||||
$dialog->addSubmitButton('Login');
|
||||
$dialog->addCancelButton('/', 'Cancel');
|
||||
$dialog->setTitle(pht('Login Required'));
|
||||
$dialog->appendChild('<p>'.pht('You must login to continue.').'</p>');
|
||||
$dialog->addSubmitButton(pht('Login'));
|
||||
$dialog->addCancelButton('/', pht('Cancel'));
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ final class PhabricatorLoginController
|
|||
$request->clearCookie('phsid');
|
||||
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle('Invalid Session');
|
||||
$error_view->setTitle(pht('Invalid Session'));
|
||||
$error_view->setErrors(array(
|
||||
"Your login session is invalid. Try logging in again. If that ".
|
||||
"doesn't work, clear your browser cookies."
|
||||
pht("Your login session is invalid. Try logging in again. If that ".
|
||||
"doesn't work, clear your browser cookies.")
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -100,12 +100,12 @@ final class PhabricatorLoginController
|
|||
$require_captcha = true;
|
||||
if (!AphrontFormRecaptchaControl::processCaptcha($request)) {
|
||||
if (AphrontFormRecaptchaControl::hasCaptchaResponse($request)) {
|
||||
$e_captcha = 'Invalid';
|
||||
$errors[] = 'CAPTCHA was not entered correctly.';
|
||||
$e_captcha = pht('Invalid');
|
||||
$errors[] = pht('CAPTCHA was not entered correctly.');
|
||||
} else {
|
||||
$e_captcha = 'Required';
|
||||
$errors[] = 'Too many login failures recently. You must '.
|
||||
'submit a CAPTCHA with your login request.';
|
||||
$e_captcha = pht('Required');
|
||||
$errors[] = pht('Too many login failures recently. You must '.
|
||||
'submit a CAPTCHA with your login request.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ final class PhabricatorLoginController
|
|||
$envelope = new PhutilOpaqueEnvelope($request->getStr('password'));
|
||||
|
||||
if (!$user || !$user->comparePassword($envelope)) {
|
||||
$errors[] = 'Bad username/password.';
|
||||
$errors[] = pht('Bad username/password.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ final class PhabricatorLoginController
|
|||
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle('Login Failed');
|
||||
$error_view->setTitle(pht('Login Failed'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
|
@ -170,16 +170,16 @@ final class PhabricatorLoginController
|
|||
->setAction('/login/')
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Username/Email')
|
||||
->setLabel(pht('Username/Email'))
|
||||
->setName('username_or_email')
|
||||
->setValue($username_or_email))
|
||||
->appendChild(
|
||||
id(new AphrontFormPasswordControl())
|
||||
->setLabel('Password')
|
||||
->setLabel(pht('Password'))
|
||||
->setName('password')
|
||||
->setCaption(
|
||||
'<a href="/login/email/">'.
|
||||
'Forgot your password? / Email Login</a>'));
|
||||
pht('Forgot your password? / Email Login').'</a>'));
|
||||
|
||||
if ($require_captcha) {
|
||||
$form->appendChild(
|
||||
|
@ -190,7 +190,7 @@ final class PhabricatorLoginController
|
|||
$form
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Login'));
|
||||
->setValue(pht('Login')));
|
||||
|
||||
|
||||
// $panel->setCreateButton('Register New Account', '/login/register/');
|
||||
|
@ -206,18 +206,18 @@ final class PhabricatorLoginController
|
|||
->setAction('/ldap/login/')
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('LDAP username')
|
||||
->setLabel(pht('LDAP username'))
|
||||
->setName('username')
|
||||
->setValue($username_or_email))
|
||||
->appendChild(
|
||||
id(new AphrontFormPasswordControl())
|
||||
->setLabel('Password')
|
||||
->setLabel(pht('Password'))
|
||||
->setName('password'));
|
||||
|
||||
$ldap_form
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Login'));
|
||||
->setValue(pht('Login')));
|
||||
|
||||
$forms['LDAP Login'] = $ldap_form;
|
||||
}
|
||||
|
@ -243,18 +243,23 @@ final class PhabricatorLoginController
|
|||
// CSRF for logged-out users is vaugely tricky.
|
||||
|
||||
if ($provider->isProviderRegistrationEnabled()) {
|
||||
$title = "Login or Register with {$provider_name}";
|
||||
$body = 'Login or register for Phabricator using your '.
|
||||
phutil_escape_html($provider_name).' account.';
|
||||
$button = "Login or Register with {$provider_name}";
|
||||
$title = pht("Login or Register with %s",
|
||||
phutil_escape_html($provider_name));
|
||||
$body = pht('Login or register for Phabricator using your %s account.',
|
||||
phutil_escape_html($provider_name));
|
||||
$button = pht("Login or Register with %s",
|
||||
phutil_escape_html($provider_name));
|
||||
} else {
|
||||
$title = "Login with {$provider_name}";
|
||||
$body = 'Login to your existing Phabricator account using your '.
|
||||
phutil_escape_html($provider_name).' account.<br /><br />'.
|
||||
'<strong>You can not use '.
|
||||
phutil_escape_html($provider_name).' to register a new '.
|
||||
'account.</strong>';
|
||||
$button = "Login with {$provider_name}";
|
||||
$title = pht("Login with %s",
|
||||
phutil_escape_html($provider_name));
|
||||
$body = pht('Login to your existing Phabricator account using your '.
|
||||
'%s account.', phutil_escape_html($provider_name)).
|
||||
'<br /><br />'.
|
||||
'<strong>'.
|
||||
pht('You can not use %s to register a new account.',
|
||||
phutil_escape_html($provider_name)).
|
||||
'</strong>';
|
||||
$button = pht("Log in with %s", phutil_escape_html($provider_name));
|
||||
}
|
||||
|
||||
$auth_form = new AphrontFormView();
|
||||
|
@ -298,7 +303,7 @@ final class PhabricatorLoginController
|
|||
$panel,
|
||||
),
|
||||
array(
|
||||
'title' => 'Login',
|
||||
'title' => pht('Login'),
|
||||
'device' => true
|
||||
));
|
||||
}
|
||||
|
|
|
@ -48,19 +48,19 @@ final class PhabricatorLoginValidateController
|
|||
$list = '<ul>'.implode("\n", $list).'</ul>';
|
||||
|
||||
$view = new AphrontRequestFailureView();
|
||||
$view->setHeader('Login Failed');
|
||||
$view->setHeader(pht('Login Failed'));
|
||||
$view->appendChild(
|
||||
'<p>Login failed:</p>'.
|
||||
'<p>'.pht('Login failed:').'</p>'.
|
||||
$list.
|
||||
'<p><strong>Clear your cookies</strong> and try again.</p>');
|
||||
'<p>'.pht('<strong>Clear your cookies</strong> and try again.').'</p>');
|
||||
$view->appendChild(
|
||||
'<div class="aphront-failure-continue">'.
|
||||
'<a class="button" href="/login/">Try Again</a>'.
|
||||
'<a class="button" href="/login/">'.pht('Try Again').'</a>'.
|
||||
'</div>');
|
||||
return $this->buildStandardPageResponse(
|
||||
$view,
|
||||
array(
|
||||
'title' => 'Login Failed',
|
||||
'title' => pht('Login Failed'),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -45,9 +45,9 @@ final class PhabricatorLogoutController
|
|||
if ($user->getPHID()) {
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($user)
|
||||
->setTitle('Log out of Phabricator?')
|
||||
->appendChild('<p>Are you sure you want to log out?</p>')
|
||||
->addSubmitButton('Log Out')
|
||||
->setTitle(pht('Log out of Phabricator?'))
|
||||
->appendChild('<p>'.pht('Are you sure you want to log out?').'</p>')
|
||||
->addSubmitButton(pht('Logout'))
|
||||
->addCancelButton('/');
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
|
|
|
@ -30,21 +30,25 @@ final class PhabricatorMustVerifyEmailController
|
|||
$email->sendVerificationEmail($user);
|
||||
$sent = new AphrontErrorView();
|
||||
$sent->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
|
||||
$sent->setTitle('Email Sent');
|
||||
$sent->appendChild(
|
||||
'<p>Another verification email was sent to <strong>'.
|
||||
phutil_escape_html($email_address).'</strong>.</p>');
|
||||
$sent->setTitle(pht('Email Sent'));
|
||||
$sent->appendChild('<p>'.
|
||||
pht('Another verification email was sent to <strong>%s</strong>.',
|
||||
phutil_escape_html($email_address)).'</p>');
|
||||
}
|
||||
|
||||
$error_view = new AphrontRequestFailureView();
|
||||
$error_view->setHeader('Check Your Email');
|
||||
$error_view->setHeader(pht('Check Your Email'));
|
||||
$error_view->appendChild(
|
||||
'<p>You must verify your email address to login. You should have a new '.
|
||||
'<p>'.
|
||||
pht('You must verify your email address to login. You should have a new '.
|
||||
'email message from Phabricator with verification instructions in your '.
|
||||
'inbox (<strong>'.phutil_escape_html($email_address).'</strong>).</p>');
|
||||
'inbox (<strong>%s</strong>).', phutil_escape_html($email_address)).
|
||||
'</p>');
|
||||
$error_view->appendChild(
|
||||
'<p>If you did not receive an email, you can click the button below '.
|
||||
'to try sending another one.</p>');
|
||||
'<p>'.
|
||||
pht('If you did not receive an email, you can click the button below '.
|
||||
'to try sending another one.').
|
||||
'</p>');
|
||||
$error_view->appendChild(
|
||||
'<div class="aphront-failure-continue">'.
|
||||
phabricator_render_form(
|
||||
|
@ -57,17 +61,18 @@ final class PhabricatorMustVerifyEmailController
|
|||
'button',
|
||||
array(
|
||||
),
|
||||
'Send Another Email')).
|
||||
pht('Send Another Email'))).
|
||||
'</div>');
|
||||
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$sent,
|
||||
$error_view,
|
||||
),
|
||||
array(
|
||||
'title' => 'Must Verify Email',
|
||||
'title' => pht('Must Verify Email'),
|
||||
'device' => true
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -68,15 +68,15 @@ final class PhabricatorOAuthLoginController
|
|||
if ($oauth_info->getUserID() != $current_user->getID()) {
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($current_user);
|
||||
$dialog->setTitle('Already Linked to Another Account');
|
||||
$dialog->appendChild(
|
||||
hsprintf(
|
||||
'<p>The %s account you just authorized is already linked to '.
|
||||
$dialog->setTitle(pht('Already Linked to Another Account'));
|
||||
$dialog->appendChild('<p>'.
|
||||
pht(
|
||||
'The %s account you just authorized is already linked to '.
|
||||
'another Phabricator account. Before you can associate your %s '.
|
||||
'account with this Phabriactor account, you must unlink it from '.
|
||||
'the Phabricator account it is currently linked to.</p>',
|
||||
$provider_name,
|
||||
$provider_name));
|
||||
phutil_escape_html($provider_name),
|
||||
phutil_escape_html($provider_name))).'</p>';
|
||||
$dialog->addCancelButton($provider->getSettingsPanelURI());
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
|
@ -95,14 +95,15 @@ final class PhabricatorOAuthLoginController
|
|||
if ($existing_oauth) {
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($current_user);
|
||||
$dialog->setTitle('Already Linked to an Account From This Provider');
|
||||
$dialog->appendChild(
|
||||
hsprintf(
|
||||
'<p>The account you are logged in with is already linked to a %s '.
|
||||
$dialog->setTitle(
|
||||
pht('Already Linked to an Account From This Provider'));
|
||||
$dialog->appendChild('<p>'.
|
||||
pht(
|
||||
'The account you are logged in with is already linked to a %s '.
|
||||
'account. Before you can link it to a different %s account, you '.
|
||||
'must unlink the old account.</p>',
|
||||
$provider_name,
|
||||
$provider_name));
|
||||
phutil_escape_html($provider_name),
|
||||
phutil_escape_html($provider_name))).'</p>';
|
||||
$dialog->addCancelButton($provider->getSettingsPanelURI());
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
@ -110,11 +111,11 @@ final class PhabricatorOAuthLoginController
|
|||
if (!$request->isDialogFormPost()) {
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($current_user);
|
||||
$dialog->setTitle('Link '.$provider_name.' Account');
|
||||
$dialog->setTitle(pht('Link %s Account', $provider_name));
|
||||
$dialog->appendChild(
|
||||
hsprintf(
|
||||
pht(
|
||||
'<p>Link your %s account to your Phabricator account?</p>',
|
||||
$provider_name));
|
||||
phutil_escape_html($provider_name)));
|
||||
$dialog->addHiddenInput('confirm_token', $provider->getAccessToken());
|
||||
$dialog->addHiddenInput('expires', $oauth_info->getTokenExpires());
|
||||
$dialog->addHiddenInput('state', $this->oauthState);
|
||||
|
@ -168,14 +169,14 @@ final class PhabricatorOAuthLoginController
|
|||
if ($known_email) {
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($current_user);
|
||||
$dialog->setTitle('Already Linked to Another Account');
|
||||
$dialog->appendChild(
|
||||
hsprintf(
|
||||
'<p>The %s account you just authorized has an email address which '.
|
||||
$dialog->setTitle(pht('Already Linked to Another Account'));
|
||||
$dialog->appendChild('<p>'.
|
||||
pht(
|
||||
'The %s account you just authorized has an email address which '.
|
||||
'is already in use by another Phabricator account. To link the '.
|
||||
'accounts, log in to your Phabricator account and then go to '.
|
||||
'Settings.</p>',
|
||||
$provider_name));
|
||||
'Settings.',
|
||||
phutil_escape_html($provider_name))).'</p>';
|
||||
|
||||
$user = id(new PhabricatorUser())
|
||||
->loadOneWhere('phid = %s', $known_email->getUserPHID());
|
||||
|
@ -189,9 +190,9 @@ final class PhabricatorOAuthLoginController
|
|||
->getProviderName();
|
||||
}
|
||||
$dialog->appendChild(
|
||||
hsprintf(
|
||||
pht(
|
||||
'<p>The account is associated with: %s.</p>',
|
||||
implode(', ', $providers)));
|
||||
implode(', ', phutil_escape_html($providers))));
|
||||
}
|
||||
|
||||
$dialog->addCancelButton('/login/');
|
||||
|
@ -203,14 +204,14 @@ final class PhabricatorOAuthLoginController
|
|||
if (!$provider->isProviderRegistrationEnabled()) {
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($current_user);
|
||||
$dialog->setTitle('No Account Registration With '.$provider_name);
|
||||
$dialog->appendChild(
|
||||
hsprintf(
|
||||
'<p>You can not register a new account using %s; you can only use '.
|
||||
$dialog->setTitle(pht('No Account Registration with %s', $provider_name));
|
||||
$dialog->appendChild('<p>'.
|
||||
pht(
|
||||
'You can not register a new account using %s; you can only use '.
|
||||
'your %s account to log into an existing Phabricator account which '.
|
||||
'you have registered through other means.</p>',
|
||||
$provider_name,
|
||||
$provider_name));
|
||||
'you have registered through other means.',
|
||||
phutil_escape_html($provider_name),
|
||||
phutil_escape_html($provider_name))).'</p>';
|
||||
$dialog->addCancelButton('/login/');
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
|
@ -242,7 +243,7 @@ final class PhabricatorOAuthLoginController
|
|||
return $this->buildStandardPageResponse(
|
||||
$view,
|
||||
array(
|
||||
'title' => $provider_name.' Auth Failed',
|
||||
'title' => pht('Auth Failed'),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ final class PhabricatorOAuthUnlinkController extends PhabricatorAuthController {
|
|||
|
||||
if ($provider->isProviderLinkPermanent()) {
|
||||
throw new Exception(
|
||||
"You may not unlink accounts from this OAuth provider.");
|
||||
pht("You may not unlink accounts from this OAuth provider."));
|
||||
}
|
||||
|
||||
$provider_key = $provider->getProviderKey();
|
||||
|
@ -33,11 +33,11 @@ final class PhabricatorOAuthUnlinkController extends PhabricatorAuthController {
|
|||
if (!$request->isDialogFormPost()) {
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setUser($user);
|
||||
$dialog->setTitle('Really unlink account?');
|
||||
$dialog->setTitle(pht('Really unlink account?'));
|
||||
$dialog->appendChild(
|
||||
'<p><strong>You will not be able to login</strong> using this account '.
|
||||
'once you unlink it. Continue?</p>');
|
||||
$dialog->addSubmitButton('Unlink Account');
|
||||
'<p>'.pht('You will not be able to login using this account '.
|
||||
'once you unlink it. Continue?').'</p>');
|
||||
$dialog->addSubmitButton(pht('Unlink Account'));
|
||||
$dialog->addCancelButton($provider->getSettingsPanelURI());
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
|
|
|
@ -45,10 +45,10 @@ final class PhabricatorOAuthDefaultRegistrationController
|
|||
$user->setUsername($request->getStr('username'));
|
||||
$username = $user->getUsername();
|
||||
if (!strlen($user->getUsername())) {
|
||||
$e_username = 'Required';
|
||||
$errors[] = 'Username is required.';
|
||||
$e_username = pht('Required');
|
||||
$errors[] = pht('Username is required.');
|
||||
} else if (!PhabricatorUser::validateUsername($username)) {
|
||||
$e_username = 'Invalid';
|
||||
$e_username = pht('Invalid');
|
||||
$errors[] = PhabricatorUser::describeValidUsername();
|
||||
} else {
|
||||
$e_username = null;
|
||||
|
@ -57,8 +57,8 @@ final class PhabricatorOAuthDefaultRegistrationController
|
|||
if (!$new_email) {
|
||||
$new_email = trim($request->getStr('email'));
|
||||
if (!$new_email) {
|
||||
$e_email = 'Required';
|
||||
$errors[] = 'Email is required.';
|
||||
$e_email = pht('Required');
|
||||
$errors[] = pht('Email is required.');
|
||||
} else {
|
||||
$e_email = null;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ final class PhabricatorOAuthDefaultRegistrationController
|
|||
if ($new_email) {
|
||||
$email_ok = PhabricatorUserEmail::isAllowedAddress($new_email);
|
||||
if (!$email_ok) {
|
||||
$e_email = 'Invalid';
|
||||
$e_email = pht('Invalid');
|
||||
$errors[] = PhabricatorUserEmail::describeAllowedAddresses();
|
||||
}
|
||||
}
|
||||
|
@ -75,8 +75,8 @@ final class PhabricatorOAuthDefaultRegistrationController
|
|||
if (!strlen($user->getRealName())) {
|
||||
$user->setRealName($request->getStr('realname'));
|
||||
if (!strlen($user->getRealName())) {
|
||||
$e_realname = 'Required';
|
||||
$errors[] = 'Real name is required.';
|
||||
$e_realname = pht('Required');
|
||||
$errors[] = pht('Real name is required.');
|
||||
} else {
|
||||
$e_realname = null;
|
||||
}
|
||||
|
@ -142,11 +142,11 @@ final class PhabricatorOAuthDefaultRegistrationController
|
|||
$new_email);
|
||||
|
||||
if ($same_username) {
|
||||
$e_username = 'Duplicate';
|
||||
$errors[] = 'That username or email is not unique.';
|
||||
$e_username = pht('Duplicate');
|
||||
$errors[] = pht('That username or email is not unique.');
|
||||
} else if ($same_email) {
|
||||
$e_email = 'Duplicate';
|
||||
$errors[] = 'That email is not unique.';
|
||||
$e_email = pht('Duplicate');
|
||||
$errors[] = pht('That email is not unique.');
|
||||
} else {
|
||||
throw $exception;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ final class PhabricatorOAuthDefaultRegistrationController
|
|||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setTitle('Registration Failed');
|
||||
$error_view->setTitle(pht('Registration Failed'));
|
||||
$error_view->setErrors($errors);
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ final class PhabricatorOAuthDefaultRegistrationController
|
|||
->setAction($action_path)
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Username')
|
||||
->setLabel(pht('Username'))
|
||||
->setName('username')
|
||||
->setValue($user->getUsername())
|
||||
->setError($e_username));
|
||||
|
@ -184,7 +184,7 @@ final class PhabricatorOAuthDefaultRegistrationController
|
|||
if ($show_email_input) {
|
||||
$form->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Email')
|
||||
->setLabel(pht('Email'))
|
||||
->setName('email')
|
||||
->setValue($request->getStr('email'))
|
||||
->setCaption(PhabricatorUserEmail::describeAllowedAddresses())
|
||||
|
@ -194,7 +194,7 @@ final class PhabricatorOAuthDefaultRegistrationController
|
|||
if ($provider->retrieveUserRealName() === null) {
|
||||
$form->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setLabel('Real Name')
|
||||
->setLabel(pht('Real Name'))
|
||||
->setName('realname')
|
||||
->setValue($request->getStr('realname'))
|
||||
->setError($e_realname));
|
||||
|
@ -203,20 +203,22 @@ final class PhabricatorOAuthDefaultRegistrationController
|
|||
$form
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Create Account'));
|
||||
->setValue(pht('Create Account')));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('Create New Account');
|
||||
$panel->setHeader(pht('Create New Account'));
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
||||
$panel->appendChild($form);
|
||||
$panel->setNoBackground();
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$error_view,
|
||||
$panel,
|
||||
),
|
||||
array(
|
||||
'title' => 'Create New Account',
|
||||
'title' => pht('Create New Account'),
|
||||
'device' => true
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ final class PhabricatorOAuthFailureView extends AphrontView {
|
|||
$diagnose = null;
|
||||
|
||||
$view = new AphrontRequestFailureView();
|
||||
$view->setHeader($provider_name.' Auth Failed');
|
||||
$view->setHeader(pht('%s Auth Failed', $provider_name));
|
||||
if ($this->request) {
|
||||
$view->appendChild(
|
||||
hsprintf(
|
||||
|
@ -79,7 +79,7 @@ final class PhabricatorOAuthFailureView extends AphrontView {
|
|||
$view->appendChild(
|
||||
'<div class="aphront-failure-continue">'.
|
||||
$diagnose.
|
||||
'<a href="/login/" class="button">Continue</a>'.
|
||||
'<a href="/login/" class="button">'.pht('Continue').'</a>'.
|
||||
'</div>');
|
||||
|
||||
return $view->render();
|
||||
|
|
Loading…
Reference in a new issue