You are here

function _bakery_pass_validate in Bakery Single Sign-On System 6.2

Same name and namespace in other branches
  1. 8.2 bakery.module \_bakery_pass_validate()
  2. 7.2 bakery.module \_bakery_pass_validate()

Validate handler for the password reset login.

1 string reference to '_bakery_pass_validate'
bakery_form_alter in ./bakery.module
Implementation of hook_form_alter().

File

./bakery.module, line 336

Code

function _bakery_pass_validate($form, &$form_state) {

  // On a slave site it's possible that a user requests their password but
  // doesn't have an account on the slave site. So, we check if that's the case
  // and use our helpful functions to create their account on the slave site.
  $name = trim($form_state['values']['name']);
  $account = user_load(array(
    'mail' => $name,
  ));
  if (!$account) {

    // No success, try to load by name.
    $account = user_load(array(
      'name' => $name,
    ));
  }
  if (!$account) {

    // Attempt to copy account from master.
    bakery_request_account($name, TRUE);
  }
}