Update to Drupal 8.1.5. For more information, see https://www.drupal.org/project/drupal/releases/8.1.5

This commit is contained in:
Pantheon Automation 2016-07-07 09:44:38 -07:00 committed by Greg Anderson
parent 13b6ca7cc2
commit 38ba7c357d
342 changed files with 7814 additions and 1534 deletions

View file

@ -28,6 +28,8 @@ class PasswordItem extends StringItem {
->setSetting('case_sensitive', TRUE);
$properties['existing'] = DataDefinition::create('string')
->setLabel(new TranslatableMarkup('Existing password'));
$properties['pre_hashed'] = DataDefinition::create('boolean')
->setLabel(new TranslatableMarkup('Determines if a password needs hashing'));
return $properties;
}
@ -40,8 +42,11 @@ class PasswordItem extends StringItem {
$entity = $this->getEntity();
// Update the user password if it has changed.
if ($entity->isNew() || (strlen(trim($this->value)) > 0 && $this->value != $entity->original->{$this->getFieldDefinition()->getName()}->value)) {
if ($this->pre_hashed) {
// Reset the pre_hashed value since it has now been used.
$this->pre_hashed = FALSE;
}
elseif ($entity->isNew() || (strlen(trim($this->value)) > 0 && $this->value != $entity->original->{$this->getFieldDefinition()->getName()}->value)) {
// Allow alternate password hashing schemes.
$this->value = \Drupal::service('password')->hash(trim($this->value));
// Abort if the hashing failed and returned FALSE.