get('multi_step'); $data = $tempstore->get('combovalue'); if (strpos($data, "@") == TRUE) { $form['account']['mail']['#default_value'] = $data; } else { $form['account']['name']['#default_value'] = $data; } break; } } /** * Implements hook_help(). */ function multi_step_help($route_name, RouteMatchInterface $route_match) { switch ($route_name) { // Main module help for the multi_step module. case 'help.page.multi_step': return check_markup(file_get_contents(dirname(__FILE__) . "/README.txt")); } } /** * Checking email is exist or not. */ function multi_step_check_for_existing_user_email($value) { $query = \Drupal::database()->select('users_field_data', 'u'); $query->fields('u', ['mail']); $query->condition('u.mail', $value, '='); $results = $query->execute()->fetchAssoc(); return $results; } /** * Fetching uid on basis of email and password. */ function multi_step_get_uid_from_email($email, $password) { $users = \Drupal::entityTypeManager()->getStorage('user') ->loadByProperties(['mail' => $email]); $user = reset($users); $username = $user->getDisplayName(); if ($user) { $uid = \Drupal::service('user.auth')->authenticate($username, $password); } return $uid; } /** * Checking username is exist or not. */ function multi_step_check_for_existing_user_name($value) { $query = \Drupal::database()->select('users_field_data', 'u'); $query->fields('u', ['name']); $query->condition('u.name', $value, '='); $results = $query->execute()->fetchAssoc(); return $results; }