You are here

public function AccountProxy::getUsername in Restrict Login or Role Access by IP Address 8.4

Returns the unaltered login name of this account.

Return value

string An unsanitized plain-text string with the name of this account that is used to log in. Only display this name to admins and to the user who owns this account, and only in the context of the name used to log in. For any other display purposes, use \Drupal\Core\Session\AccountInterface::getDisplayName() instead.

Overrides AccountInterface::getUsername

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Session\AccountInterface::getAccountName() or \Drupal\user\UserInterface::getDisplayName() instead.

See also

https://www.drupal.org/node/2572493

File

src/Session/AccountProxy.php, line 118
Contains \Drupal\restrict_by_ip\Session\AccountProxy.

Class

AccountProxy
When the current user is loaded, remove any roles that are restricted based on IP whitelists. Proxy all other method calls to the original current_user service.

Namespace

Drupal\restrict_by_ip\Session

Code

public function getUsername() {
  return $this->original
    ->getUsername();
}