You are here

private function AuthController::generatePassword in Auth0 Single Sign On 8.2

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

Generate a random password.

Parameters

int $length: The length of the password.

Return value

bool|string The generate password.

Throws

\Exception

1 call to AuthController::generatePassword()
AuthController::createDrupalUser in src/Controller/AuthController.php
Create the Drupal user based on the Auth0 user profile.

File

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

Class

AuthController
Controller routines for auth0 authentication.

Namespace

Drupal\auth0\Controller

Code

private function generatePassword($length) {
  return substr(preg_replace("/[^a-zA-Z0-9]\\+\\//", "", base64_encode($this
    ->getRandomBytes($length + 1))), 0, $length);
}