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