Update to Drupal 8.1.2. For more information, see https://www.drupal.org/project/drupal/releases/8.1.2
This commit is contained in:
parent
9eae24d844
commit
28556d630e
1322 changed files with 6699 additions and 2064 deletions
|
@ -24,4 +24,5 @@ class RegisterAccessCheck implements AccessInterface {
|
|||
$user_settings = \Drupal::config('user.settings');
|
||||
return AccessResult::allowedIf($account->isAnonymous() && $user_settings->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY)->cacheUntilConfigurationChanges($user_settings);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -387,8 +387,9 @@ abstract class AccountForm extends ContentEntityForm {
|
|||
$user = $this->getEntity($form_state);
|
||||
// If there's a session set to the users id, remove the password reset tag
|
||||
// since a new password was saved.
|
||||
if (isset($_SESSION['pass_reset_'. $user->id()])) {
|
||||
unset($_SESSION['pass_reset_'. $user->id()]);
|
||||
if (isset($_SESSION['pass_reset_' . $user->id()])) {
|
||||
unset($_SESSION['pass_reset_' . $user->id()]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ use Drupal\Core\Form\FormStateInterface;
|
|||
* "user" = @ContextDefinition("entity:user", label = @Translation("User"))
|
||||
* }
|
||||
* )
|
||||
*
|
||||
*/
|
||||
class UserRole extends ConditionPluginBase {
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ class UserSearch extends SearchPluginBase implements AccessibleInterface {
|
|||
return $results;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHelp() {
|
||||
|
|
|
@ -20,4 +20,5 @@ class UserNameConstraint extends Constraint {
|
|||
public $multipleSpacesMessage = 'The username cannot contain multiple spaces in a row.';
|
||||
public $illegalMessage = 'The username contains an illegal character.';
|
||||
public $tooLongMessage = 'The username %name is too long: it must be %max characters or less.';
|
||||
|
||||
}
|
||||
|
|
|
@ -31,15 +31,24 @@ class UserNameConstraintValidator extends ConstraintValidator {
|
|||
}
|
||||
if (preg_match('/[^\x{80}-\x{F7} a-z0-9@_.\'-]/i', $name)
|
||||
|| preg_match(
|
||||
'/[\x{80}-\x{A0}' . // Non-printable ISO-8859-1 + NBSP
|
||||
'\x{AD}' . // Soft-hyphen
|
||||
'\x{2000}-\x{200F}' . // Various space characters
|
||||
'\x{2028}-\x{202F}' . // Bidirectional text overrides
|
||||
'\x{205F}-\x{206F}' . // Various text hinting characters
|
||||
'\x{FEFF}' . // Byte order mark
|
||||
'\x{FF01}-\x{FF60}' . // Full-width latin
|
||||
'\x{FFF9}-\x{FFFD}' . // Replacement characters
|
||||
'\x{0}-\x{1F}]/u', // NULL byte and control characters
|
||||
// Non-printable ISO-8859-1 + NBSP
|
||||
'/[\x{80}-\x{A0}' .
|
||||
// Soft-hyphen
|
||||
'\x{AD}' .
|
||||
// Various space characters
|
||||
'\x{2000}-\x{200F}' .
|
||||
// Bidirectional text overrides
|
||||
'\x{2028}-\x{202F}' .
|
||||
// Various text hinting characters
|
||||
'\x{205F}-\x{206F}' .
|
||||
// Byte order mark
|
||||
'\x{FEFF}' .
|
||||
// Full-width latin
|
||||
'\x{FF01}-\x{FF60}' .
|
||||
// Replacement characters
|
||||
'\x{FFF9}-\x{FFFD}' .
|
||||
// NULL byte and control characters
|
||||
'\x{0}-\x{1F}]/u',
|
||||
$name)
|
||||
) {
|
||||
$this->context->addViolation($constraint->illegalMessage);
|
||||
|
@ -48,4 +57,5 @@ class UserNameConstraintValidator extends ConstraintValidator {
|
|||
$this->context->addViolation($constraint->tooLongMessage, array('%name' => $name, '%max' => USERNAME_MAX_LENGTH));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ class ConvertTokens extends ProcessPluginBase {
|
|||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
$tokens = array(
|
||||
|
|
|
@ -109,5 +109,4 @@ class User extends Entity {
|
|||
return $dependencies;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class Name extends InOperator {
|
|||
'#target_type' => 'user',
|
||||
'#tags' => TRUE,
|
||||
'#default_value' => $default_value,
|
||||
'#process_default_value' => FALSE,
|
||||
'#process_default_value' => $this->isExposed(),
|
||||
);
|
||||
|
||||
$user_input = $form_state->getUserInput();
|
||||
|
|
|
@ -203,4 +203,5 @@ class PrivateTempStore {
|
|||
protected function getOwner() {
|
||||
return $this->currentUser->id() ?: $this->requestStack->getCurrentRequest()->getSession()->getId();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class ProfileTranslationHandler extends ContentTranslationHandler {
|
|||
*
|
||||
* This handles the save action.
|
||||
*
|
||||
* @see \Drupal\Core\Entity\EntityForm::build().
|
||||
* @see \Drupal\Core\Entity\EntityForm::build()
|
||||
*/
|
||||
public function entityFormSave(array $form, FormStateInterface $form_state) {
|
||||
if ($this->getSourceLangcode($form_state)) {
|
||||
|
|
|
@ -135,4 +135,5 @@ class RegisterForm extends AccountForm {
|
|||
$form_state->setRedirect('<front>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,4 +44,5 @@ class UserAdminSettingsFormTest extends SystemConfigFormTestBase {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -196,4 +196,5 @@ class UserAdminTest extends WebTestBase {
|
|||
));
|
||||
$this->assertTrue(count($user_mail), 'New user mail to user is sent from configured Notification Email address');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -130,4 +130,5 @@ class UserBlocksTest extends WebTestBase {
|
|||
->fields(array('access' => $access))
|
||||
->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,4 +41,5 @@ class UserCreateFailMailTest extends WebTestBase {
|
|||
$this->assertText(t('Unable to send email. Contact the site administrator if the problem persists.'));
|
||||
$this->assertNoText(t('A welcome message with further instructions has been emailed to the new user @name.', array('@name' => $edit['name'])));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -126,4 +126,5 @@ class UserCreateTest extends WebTestBase {
|
|||
$this->assertText("Created a new user account for $name. No email has been sent");
|
||||
$this->assertNoText('Password field is required');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,4 +51,5 @@ class UserDeleteTest extends WebTestBase {
|
|||
$this->assertNull(User::load($user_b->id()), format_string('User with id @uid deleted.', array('@uid' => $user_b->id())));
|
||||
$this->assertNull(User::load($user_c->id()), format_string('User with id @uid deleted.', array('@uid' => $user_c->id())));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -136,4 +136,5 @@ class UserEditTest extends WebTestBase {
|
|||
$this->drupalPostForm("user/" . $user1->id() . "/edit", array('mail' => ''), t('Save'));
|
||||
$this->assertRaw(t("The changes have been saved."));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,4 +39,5 @@ class UserEditedOwnAccountTest extends WebTestBase {
|
|||
$account->name = $edit['name'];
|
||||
$this->drupalLogin($account);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -99,4 +99,5 @@ class UserLanguageCreationTest extends WebTestBase {
|
|||
$this->drupalGet($user_edit);
|
||||
$this->assertOptionSelected("edit-preferred-langcode", $langcode, 'Language selector is accessible and correct language is selected.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,4 +63,5 @@ class UserLanguageTest extends WebTestBase {
|
|||
|
||||
$this->drupalLogout();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -174,4 +174,5 @@ class UserLoginTest extends WebTestBase {
|
|||
$this->assertText(t('Unrecognized username or password. Have you forgotten your password?'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -139,4 +139,5 @@ class UserPictureTest extends WebTestBase {
|
|||
$account = $user_storage->load($this->webUser->id());
|
||||
return File::load($account->user_picture->target_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -128,4 +128,5 @@ class UserRoleAdminTest extends WebTestBase {
|
|||
// The order of the roles should be reversed.
|
||||
$this->assertIdentical($rids, array_reverse($saved_rids));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -90,4 +90,5 @@ class UserRolesAssignmentTest extends WebTestBase {
|
|||
$this->assertTrue(array_search($rid, $account->getRoles()) === FALSE, 'The role is not present in the user object.');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -115,4 +115,5 @@ class UserSearchTest extends WebTestBase {
|
|||
$this->assertResponse('403', 'User without search permission cannot search');
|
||||
$this->drupalLogout();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -83,4 +83,5 @@ class UserTimeZoneTest extends WebTestBase {
|
|||
$this->drupalGet('/system-test/date');
|
||||
$this->assertText('2016-01-13 08:29 PST', 'Date should be PST.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -164,4 +164,5 @@ class UserTokenReplaceTest extends WebTestBase {
|
|||
$output = $token_service->replace($input, ['user' => $user1]);
|
||||
$this->assertEqual($output, $expected, new FormattableMarkup('User token %token does not escape safe markup.', ['%token' => 'display-name']));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,4 +62,5 @@ abstract class AccessTestBase extends UserTestBase {
|
|||
// @todo when all the plugin information is cached make a reset function and
|
||||
// call it here.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -127,4 +127,5 @@ class BulkFormAccessTest extends UserTestBase {
|
|||
$account = User::load($account2->id());
|
||||
$this->assertNull($account, 'The user "may_delete" is deleted.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -135,4 +135,5 @@ class BulkFormTest extends UserTestBase {
|
|||
$errors = $view->validate();
|
||||
$this->assertEqual(reset($errors['default']), t('Field %field set in %filter is not usable for this filter type. Combined field filter only works for simple fields.', array('%field' => 'User: Bulk update', '%filter' => 'Global: Combine fields filter')));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -137,6 +137,17 @@ class HandlerFilterUserNameTest extends ViewTestBase {
|
|||
$this->drupalGet($path, $options);
|
||||
$this->assertRaw(t('There are no entities matching "%value".', array('%value' => implode(', ', $users))));
|
||||
|
||||
// Pass in an invalid target_id in for the entity_autocomplete value format.
|
||||
// There should be no errors, but all results should be returned as the
|
||||
// default value for the autocomplete will not match any users so should
|
||||
// be empty.
|
||||
$options['query']['uid'] = [['target_id' => 9999]];
|
||||
$this->drupalGet($path, $options);
|
||||
// The actual result should contain all of the user ids.
|
||||
foreach ($this->accounts as $account) {
|
||||
$this->assertRaw($account->id());
|
||||
}
|
||||
|
||||
// Pass in an invalid username and a valid username.
|
||||
$users = array($this->randomMachineName(), $this->names[0]);
|
||||
$users = array_map('strtolower', $users);
|
||||
|
@ -156,6 +167,18 @@ class HandlerFilterUserNameTest extends ViewTestBase {
|
|||
foreach ($this->accounts as $account) {
|
||||
$this->assertRaw($account->id());
|
||||
}
|
||||
|
||||
// Pass in just valid user IDs in the entity_autocomplete target_id format.
|
||||
$options['query']['uid'] = array_map(function($account) {
|
||||
return ['target_id' => $account->id()];
|
||||
}, $this->accounts);
|
||||
|
||||
$this->drupalGet($path, $options);
|
||||
$this->assertNoRaw('Unable to find user');
|
||||
// The actual result should contain all of the user ids.
|
||||
foreach ($this->accounts as $account) {
|
||||
$this->assertRaw($account->id());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ interface UserInterface extends ContentEntityInterface, EntityChangedInterface,
|
|||
* @return bool
|
||||
* TRUE if the correct existing password was provided.
|
||||
*
|
||||
* @see UserInterface::setExistingPassword().
|
||||
* @see UserInterface::setExistingPassword()
|
||||
*/
|
||||
public function checkExistingPassword(UserInterface $account_unchanged);
|
||||
|
||||
|
|
|
@ -94,4 +94,5 @@ class UserEntityReferenceTest extends EntityKernelTestBase {
|
|||
$matches = $autocomplete->getMatches('user', 'default', $field_definition->getSetting('handler_settings'), 'aabbbb');
|
||||
$this->assertEqual(count($matches), 0, '');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -426,6 +426,7 @@ class TestPermissionCallbacks {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -261,7 +261,6 @@ function user_load_by_name($name) {
|
|||
* @return string|null
|
||||
* A translated violation message if the name is invalid or NULL if the name
|
||||
* is valid.
|
||||
*
|
||||
*/
|
||||
function user_validate_name($name) {
|
||||
$definition = BaseFieldDefinition::create('string')
|
||||
|
|
Reference in a new issue