Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / user / src / AccountForm.php
index f5e2e49acf4c980497d20cb832fe0f8f952acdd6..d6959681f48ac46672b404d0a201f44067d91d07 100644 (file)
@@ -85,7 +85,7 @@ abstract class AccountForm extends ContentEntityForm {
       '#type' => 'email',
       '#title' => $this->t('Email address'),
       '#description' => $this->t('A valid email address. All emails from the system will be sent to this address. The email address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by email.'),
-      '#required' => !(!$account->getEmail() && $user->hasPermission('administer users')),
+      '#required' => !(!$account->getEmail() && $admin),
       '#default_value' => (!$register ? $account->getEmail() : ''),
     ];
 
@@ -222,7 +222,7 @@ abstract class AccountForm extends ContentEntityForm {
       '#open' => TRUE,
       // Display language selector when either creating a user on the admin
       // interface or editing a user account.
-      '#access' => !$register || $user->hasPermission('administer users'),
+      '#access' => !$register || $admin,
     ];
 
     $form['language']['preferred_langcode'] = [