X-Git-Url: http://git.pjr.cc/?p=ga4php.git;a=blobdiff_plain;f=lib%2Fga4php.php;fp=lib%2Fga4php.php;h=d79b99ac4b2197959cbefae54d6e2a2af3ef19e1;hp=8bc5946d6db8ac2be21d96926ab43b107a1a1e72;hb=0cc1148a3d3cf7b5990fa80a8aa33990ebace98a;hpb=263e289ee72fda774eb231727d574d35ab1533fb diff --git a/lib/ga4php.php b/lib/ga4php.php index 8bc5946..d79b99a 100644 --- a/lib/ga4php.php +++ b/lib/ga4php.php @@ -16,6 +16,7 @@ abstract class GoogleAuthenticator { $data["tokentimer"] = 30; // the token timer (For totp) and not supported by ga yet $data["tokencounter"] = 1; // the token counter for hotp $data["tokenalgorithm"] = "SHA1"; // the token algorithm (not supported by ga yet) + $data["user1"] = ""; // a place for implementors to store their own data return $data; } @@ -106,10 +107,10 @@ abstract class GoogleAuthenticator { function authenticateUser($username, $code) { if(preg_match("/[0-9][0-9][0-9][0-9][0-9][0-9]/",$code)<1) return false; - error_log("begin auth user"); + //error_log("begin auth user"); $tokendata = $this->internalGetData($username); - $asdf = print_r($tokendata, true); - error_log("dat is $asdf"); + //$asdf = print_r($tokendata, true); + //error_log("dat is $asdf"); if($tokendata["tokenkey"] == "") { $errorText = "No Assigned Token"; @@ -121,8 +122,8 @@ abstract class GoogleAuthenticator { $tlid = $tokendata["tokencounter"]; $tkey = $tokendata["tokenkey"]; - $asdf = print_r($tokendata, true); - error_log("dat is $asdf"); + //$asdf = print_r($tokendata, true); + //error_log("dat is $asdf"); switch($ttype) { case "HOTP": error_log("in hotp"); @@ -206,6 +207,7 @@ abstract class GoogleAuthenticator { return false; break; case "TOTP": + // ignore it? break; default: echo "how the frig did i end up here?"; @@ -225,9 +227,10 @@ abstract class GoogleAuthenticator { $data = $this->internalGetData($user); $toktype = $data["tokentype"]; $key = $this->helperhex2b32($data["tokenkey"]); + $counter = $data["tokencounter"]; $toktype = strtolower($toktype); if($toktype == "hotp") { - $url = "otpauth://$toktype/$user?secret=$key&counter=1"; + $url = "otpauth://$toktype/$user?secret=$key&counter=$counter"; } else { $url = "otpauth://$toktype/$user?secret=$key"; }