user->getParameters()->get('tfa.otep', array()); // If there is no OTEP we can't authenticate if (empty($oteps)) { return false; } $oteps = (array)$oteps; // Does this OTEP exist in the list? $tempOtp = preg_filter('/\D/', '', $otp); $otp = is_null($tempOtp) ? $otp : $tempOtp; // No. Can't authenticate. if (!in_array($otp, $oteps)) { return false; } // Remove the OTEP from the list $array_pos = array_search($otp, $oteps); $temp = array(); // Ugly as heck, but PHP freaks out with the number-as-string array indexes it produces. foreach ($oteps as $foo) { if ($foo == $otp) { continue; } $temp[] = $foo; } // Save the modified user $this->user->getParameters()->set('tfa.otep', $temp); $userManager = \Awf\Application\Application::getInstance()->getContainer()->userManager; $userManager->saveUser($this->user); // OK, we can authenticate return true; } }