You are here

function mailhandler_user_load in Mailhandler 6

Same name and namespace in other branches
  1. 5 mailhandler.module \mailhandler_user_load()
  2. 7 mailhandler.module \mailhandler_user_load()

Retrieve user information from his email address.

3 calls to mailhandler_user_load()
mailhandler_authenticate_default in ./mailhandler.module
Authenticate message based on sender's email address If the sender's email address matches an email address of a valid user, then assign that user's uid and name to the node object.
mailhandler_authenticate_tokenauth in ./mailhandler.module
Authenticate message based on token from tokenauth module If the user's token is found somewhere in the "to" field, assign that user's uid and name to the node object. A rough search for the token somewhere in the…
mailhandler_user_load_alias in ./mailhandler.module
Look up a user based on their mailalias addresses

File

./mailhandler.module, line 1253
Mailhandler module code.

Code

function mailhandler_user_load($mail, $pass, $mailbox) {
  if ($mailbox['security'] == 1) {
    if (!($account = user_load(array(
      'mail' => $mail,
      'pass' => $pass,
    )))) {
      mailhandler_watchdog_record('Wrong password used in message commands for %address', array(
        '%address' => $mail,
      ), WATCHDOG_NOTICE);
    }
    return $account;
  }
  else {
    return user_load(array(
      'mail' => $mail,
    ));
  }
}