You are here

function sms_user_authenticate in SMS Framework 5

Same name and namespace in other branches
  1. 6.2 modules/sms_user/sms_user.module \sms_user_authenticate()
  2. 6 modules/sms_user/sms_user.module \sms_user_authenticate()
  3. 7 modules/sms_user/sms_user.module \sms_user_authenticate()

Authenticate a user based on mobile number.

Parameters

$number: The number to authenticate against. For security, this should only be provided by incoming messages, not through user input.

1 call to sms_user_authenticate()
sms_user_sms_incoming in modules/sms_user/sms_user.module
Implementation of hook_sms_incoming().

File

modules/sms_user/sms_user.module, line 497
Provides integration between the SMS Framework and Drupal users.

Code

function sms_user_authenticate($number) {
  global $user;
  $uid = sms_user_get_uid($number);
  if ($account = user_load(array(
    'uid' => $uid,
    'status' => 1,
  ))) {
    $user = $account;
    watchdog('sms', t('%name was authenticated using SMS.', array(
      '%name' => $user->name,
    )));
    return $user;
  }
}