You are here

public function GALoginGA::putData in Google Authenticator login 7

Save data associated with a user.

Overrides GoogleAuthenticator::putData

File

./ga_login.class.php, line 43

Class

GALoginGA

Code

public function putData($username, $data) {

  // Encrypt the data, if a plugin in available.
  if (module_exists('aes')) {
    $data = aes_encrypt($data);
  }
  elseif (module_exists('encrypt')) {
    $data = encrypt($data);
  }
  $result = db_merge('ga_login')
    ->key(array(
    'name' => $username,
  ))
    ->fields(array(
    'keydata' => $data,
  ))
    ->execute();
  if ($result) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}