Commit 0e4c0f30 authored by webchick's avatar webchick

Issue #2576037 by unqunq, er.manojsharma, sdstyles, martins.kajins, Devaraj...

Issue #2576037 by unqunq, er.manojsharma, sdstyles, martins.kajins, Devaraj johnson, cilefen, Bojhan, Wim Leers: "Sorry" in user-facing errors violates the User Interface Standards
parent b78a2779
......@@ -1314,7 +1314,7 @@ function install_select_language(&$install_state) {
return;
}
else {
throw new InstallerException(t('Sorry, you must select a language to continue the installation.'));
throw new InstallerException(t('You must select a language to continue the installation.'));
}
}
}
......
......@@ -50,7 +50,7 @@ public function __construct(HttpKernelInterface $http_kernel, BanIpManagerInterf
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
$ip = $request->getClientIp();
if ($this->banIpManager->isBanned($ip)) {
return new Response(SafeMarkup::format('Sorry @ip has been banned', ['@ip' => $ip]), 403);
return new Response(SafeMarkup::format('@ip has been banned', ['@ip' => $ip]), 403);
}
return $this->httpKernel->handle($request, $type, $catch);
}
......
......@@ -410,7 +410,7 @@
entityModel.set('state', 'opened', {reason: 'networkerror'});
// Show a modal to inform the user of the network error.
var message = Drupal.t('Your changes to <q>@entity-title</q> could not be saved, either due to a website problem or a network connection problem.<br>Please try again.', {'@entity-title': entityModel.get('label')});
Drupal.quickedit.util.networkErrorModal(Drupal.t('Sorry!'), message);
Drupal.quickedit.util.networkErrorModal(Drupal.t('Network problem!'), message);
}
});
}
......
......@@ -125,7 +125,7 @@
// Show a modal to inform the user of the network error.
var fieldLabel = Drupal.quickedit.metadata.get(fieldID, 'label');
var message = Drupal.t('Could not load the form for <q>@field-label</q>, either due to a website problem or a network connection problem.<br>Please try again.', {'@field-label': fieldLabel});
Drupal.quickedit.util.networkErrorModal(Drupal.t('Sorry!'), message);
Drupal.quickedit.util.networkErrorModal(Drupal.t('Network problem!'), message);
// Change the state back to "candidate", to allow the user to start
// in-place editing of the field again.
......
......@@ -224,15 +224,15 @@ public function validateFinal(array &$form, FormStateInterface $form_state) {
if ($flood_control_triggered = $form_state->get('flood_control_triggered')) {
if ($flood_control_triggered == 'user') {
$form_state->setErrorByName('name', $this->formatPlural($flood_config->get('user_limit'), 'Sorry, there has been more than one failed login attempt for this account. It is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', 'Sorry, there have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', array(':url' => $this->url('user.pass'))));
$form_state->setErrorByName('name', $this->formatPlural($flood_config->get('user_limit'), 'There has been more than one failed login attempt for this account. It is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', 'There have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', array(':url' => $this->url('user.pass'))));
}
else {
// We did not find a uid, so the limit is IP-based.
$form_state->setErrorByName('name', $this->t('Sorry, too many failed login attempts from your IP address. This IP address is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', array(':url' => $this->url('user.pass'))));
$form_state->setErrorByName('name', $this->t('Too many failed login attempts from your IP address. This IP address is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', array(':url' => $this->url('user.pass'))));
}
}
else {
$form_state->setErrorByName('name', $this->t('Sorry, unrecognized username or password. <a href=":password">Have you forgotten your password?</a>', array(':password' => $this->url('user.pass', [], array('query' => array('name' => $form_state->getValue('name')))))));
$form_state->setErrorByName('name', $this->t('Unrecognized username or password. <a href=":password">Have you forgotten your password?</a>', array(':password' => $this->url('user.pass', [], array('query' => array('name' => $form_state->getValue('name')))))));
$accounts = $this->userStorage->loadByProperties(array('name' => $form_state->getValue('name')));
if (!empty($accounts)) {
$this->logger('user')->notice('Login attempt failed for %user.', array('%user' => $form_state->getValue('name')));
......
......@@ -132,7 +132,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
}
}
else {
$form_state->setErrorByName('name', $this->t('Sorry, %name is not recognized as a username or an email address.', array('%name' => $name)));
$form_state->setErrorByName('name', $this->t('%name is not recognized as a username or an email address.', array('%name' => $name)));
}
}
......
......@@ -74,7 +74,7 @@ function testUserLoginBlock() {
$this->drupalPostForm('node', $edit, t('Log in'));
$this->assertRaw('1 error has been found:');
$this->assertRaw('<a href="#edit-name">Username</a>');
$this->assertText(t('Sorry, unrecognized username or password.'));
$this->assertText(t('Unrecognized username or password.'));
// Create a user with some permission that anonymous users lack.
$user = $this->drupalCreateUser(array('administer permissions'));
......
......@@ -169,15 +169,15 @@ function assertFailedLogin($account, $flood_trigger = NULL) {
$this->assertNoFieldByXPath("//input[@name='pass' and @value!='']", NULL, 'Password value attribute is blank.');
if (isset($flood_trigger)) {
if ($flood_trigger == 'user') {
$this->assertRaw(\Drupal::translation()->formatPlural($this->config('user.flood')->get('user_limit'), 'Sorry, there has been more than one failed login attempt for this account. It is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', 'Sorry, there have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', array(':url' => \Drupal::url('user.pass'))));
$this->assertRaw(\Drupal::translation()->formatPlural($this->config('user.flood')->get('user_limit'), 'There has been more than one failed login attempt for this account. It is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', 'There have been more than @count failed login attempts for this account. It is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', array(':url' => \Drupal::url('user.pass'))));
}
else {
// No uid, so the limit is IP-based.
$this->assertRaw(t('Sorry, too many failed login attempts from your IP address. This IP address is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', array(':url' => \Drupal::url('user.pass'))));
$this->assertRaw(t('Too many failed login attempts from your IP address. This IP address is temporarily blocked. Try again later or <a href=":url">request a new password</a>.', array(':url' => \Drupal::url('user.pass'))));
}
}
else {
$this->assertText(t('Sorry, unrecognized username or password. Have you forgotten your password?'));
$this->assertText(t('Unrecognized username or password. Have you forgotten your password?'));
}
}
}
......@@ -79,7 +79,7 @@ function testUserPasswordReset() {
$edit = array('name' => $this->randomMachineName(32));
$this->drupalPostForm(NULL, $edit, t('Submit'));
$this->assertText(t('Sorry, @name is not recognized as a username or an email address.', array('@name' => $edit['name'])), 'Validation error message shown when trying to request password for invalid account.');
$this->assertText(t('@name is not recognized as a username or an email address.', array('@name' => $edit['name'])), 'Validation error message shown when trying to request password for invalid account.');
$this->assertEqual(count($this->drupalGetMails(array('id' => 'user_password_reset'))), 0, 'No email was sent when requesting a password for an invalid account.');
// Reset the password by username via the password reset page.
......@@ -220,7 +220,7 @@ public function testUserResetPasswordTextboxFilled() {
'pass' => $this->randomMachineName(),
);
$this->drupalPostForm('user/login', $edit, t('Log in'));
$this->assertRaw(t('Sorry, unrecognized username or password. <a href=":password">Have you forgotten your password?</a>',
$this->assertRaw(t('Unrecognized username or password. <a href=":password">Have you forgotten your password?</a>',
array(':password' => \Drupal::url('user.pass', [], array('query' => array('name' => $edit['name']))))));
unset($edit['pass']);
$this->drupalGet('user/password', array('query' => array('name' => $edit['name'])));
......
......@@ -80,7 +80,7 @@ public function getInstallPath(PackageInterface $package)
if ($frameworkType === false) {
throw new \InvalidArgumentException(
'Sorry the package type of this package is not yet supported.'
'The package type of this package is not yet supported.'
);
}
......
......@@ -223,7 +223,7 @@ public function getContent(FlattenException $exception)
{
switch ($exception->getStatusCode()) {
case 404:
$title = 'Sorry, the page you are looking for could not be found.';
$title = 'The page you are looking for could not be found.';
break;
default:
$title = 'Whoops, looks like something went wrong.';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment