You are here

public function UserMfaSetup::__construct in Google Authenticator / 2 Factor Authentication - 2FA 8.2

File

src/Form/UserMfaSetup.php, line 15

Class

UserMfaSetup

Namespace

Drupal\miniorange_2fa\form

Code

public function __construct() {
  $url_parts = MoAuthUtilities::mo_auth_get_url_parts();
  end($url_parts);
  $this->entityId = prev($url_parts);
  $this->savedFields = MoAuthUtilities::get_users_custom_attribute($this->entityId);
  $account = $this
    ->currentUser();
  $this->isAdmin = $account
    ->isAuthenticated() && $account
    ->hasPermission('administer users');
  $user = User::load(intval($this->entityId));
  $this->tfaRequired = MoAuthUtilities::isTFARequired($user
    ->getRoles(), $user
    ->getEmail());
}