public static function MobileNumber::registerVerificationCode in Mobile Number 7
Registers code for mobile number and returns it's token.
Parameters
string $code: Access code.
string $number: Phone number string.
Return value
string 43 character token.
Overrides MobileNumberInterface::registerVerificationCode
5 calls to MobileNumber::registerVerificationCode()
- MobileNumber::sendVerification in src/
MobileNumber.php - Send verification code to mobile number.
- MobileNumberClassTestCase::testFunctions in tests/
mobile_number.class.test - Test functions.
- MobileNumberElementTestCase::testTfa in tests/
mobile_number.element.test - Test tfa option.
- MobileNumberElementTestCase::testVerification in tests/
mobile_number.element.test - Test number verification.
- MobileNumberFieldTestCase::createMobileNumberNode in tests/
mobile_number.field.test - Create node with mobile number(s).
File
- src/
MobileNumber.php, line 244
Class
- MobileNumber
- Class MobileNumber handles mobile number validation and verification.
Code
public static function registerVerificationCode($code, $number) {
$time = time();
$token = drupal_get_token(rand(0, 999999999) . $time . 'mobile verification token' . $number);
$hash = static::codeHash($token, $code, $number);
db_insert('mobile_number_verification')
->fields(array(
'token' => $token,
'timestamp' => $time,
'verification_code' => $hash,
))
->execute();
return $token;
}