fixed a minor thing with the hotp skew
[ga4php.git] / lib / ga4php.php
index 2be25ff..3435d03 100644 (file)
@@ -53,7 +53,8 @@ abstract class GoogleAuthenticator {
        // the function used inside the class to put the data into the
        // datastore using the overloaded data saving class
        function internalPutData($username, $data) {
-               $enco = base64_encode(serialize($data));
+               if($data == "") $enco = "";
+               else $enco = base64_encode(serialize($data));
                
                return $this->putData($username, $enco);
        }
@@ -118,9 +119,7 @@ abstract class GoogleAuthenticator {
        // self explanitory?
        function deleteUser($username) {
                // oh, we need to figure out how to do thi?
-               $data = $this->internalGetData($username);
-               $data["tokenkey"] = "";
-               $this->internalPutData($username);              
+               $this->internalPutData($username, "");          
        }
        
        // user has input their user name and some code, authenticate
@@ -148,7 +147,7 @@ abstract class GoogleAuthenticator {
                switch($ttype) {
                        case "HOTP":
                                error_log("in hotp");
-                               $st = $tlid;
+                               $st = $tlid+1;
                                $en = $tlid+$this->hotpSkew;
                                for($i=$st; $i<$en; $i++) {
                                        $stest = $this->oath_hotp($tkey, $i);