You are here

public function GoogleAuthenticator::setTokenType in Google Authenticator login 7

Same name and namespace in other branches
  1. 6 ga4php.php \GoogleAuthenticator::setTokenType()

Sets the token type the user it going to use.

File

./ga4php.php, line 102
Abstract GoogleAuthenticator class.

Class

GoogleAuthenticator
@file Abstract GoogleAuthenticator class.

Code

public function setTokenType($username, $tokentype) {
  $tokentype = strtoupper($tokentype);
  if ($tokentype != "HOTP" && $tokentype != "TOTP") {
    $this->errorText = "Invalid Token Type";
    return FALSE;
  }
  $data = $this
    ->internalGetData($username);
  $data["tokentype"] = $tokentype;
  return $this
    ->internalPutData($username, $data);
}