You are here

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

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

Checks if the email is valid.

1 call to AuthController::validateUserEmail()
AuthController::processUserLogin in src/Controller/AuthController.php
Process the auth0 user profile and signin or signup the user.

File

src/Controller/AuthController.php, line 285

Class

AuthController
Controller routines for auth0 authentication.

Namespace

Drupal\auth0\Controller

Code

protected function validateUserEmail($userInfo) {
  $config = \Drupal::service('config.factory')
    ->get('auth0.settings');
  $requires_email = $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();
    }
  }
}