You are here

function apigee_edge_existing_developer_registration_hash_validate in Apigee Edge 8

Validates token for a registration with an existing developer email on Edge.

Parameters

\Drupal\user\UserInterface $account: User object.

string $token: Generated token from the url.

string $timestamp: Timestamp from url.

Return value

bool TRUE if token valid, false otherwise.

1 call to apigee_edge_existing_developer_registration_hash_validate()
apigee_edge_form_user_register_form_developer_email_validate in ./apigee_edge.module
Validates whether the provided email address is already taken on Apigee Edge.

File

./apigee_edge.module, line 1032
Copyright 2018 Google Inc.

Code

function apigee_edge_existing_developer_registration_hash_validate(UserInterface $account, string $token, string $timestamp) {
  $current = \Drupal::time()
    ->getRequestTime();
  $timeout = \Drupal::config('apigee_edge.developer_settings')
    ->get('verification_token_expires');
  if ($timestamp <= $current && $current - $timestamp < $timeout && hash_equals($token, apigee_edge_existing_developer_registration_hash($account, $timestamp))) {
    return TRUE;
  }
  return FALSE;
}