You are here

protected function AuthController::validateUserEmail in Auth0 Single Sign On 8.2

Same name and namespace in other branches
  1. 8 src/Controller/AuthController.php \Drupal\auth0\Controller\AuthController::validateUserEmail()

Checks if the email is valid.

Parameters

array $userInfo: The user information.

Throws

\Drupal\auth0\Exception\EmailNotSetException When an email hasn't been set.

\Drupal\auth0\Exception\EmailNotVerifiedException When an email hasn't been verified.

1 call to AuthController::validateUserEmail()
AuthController::processUserLogin in src/Controller/AuthController.php
Process the Auth0 user profile and sign in or sign the user up.

File

src/Controller/AuthController.php, line 509
Contains \Drupal\auth0\Controller\AuthController.

Class

AuthController
Controller routines for auth0 authentication.

Namespace

Drupal\auth0\Controller

Code

protected function validateUserEmail(array $userInfo) {
  $requires_email = $this->config
    ->get('auth0_requires_verified_email');
  if ($requires_email) {
    if (!isset($userInfo['email']) || empty($userInfo['email'])) {
      throw new EmailNotSetException();
    }
    if (!$userInfo['email_verified']) {
      throw new EmailNotVerifiedException();
    }
  }
}