Example #1
0
 /**
  * CAUTION this method uses cookie, it must be called before any print
  * this method checks code and performs login
  * this method perform redirect if the code is correct, after setting the cookie
  * @param string $code
  * @return bool true if the code is corret
  */
 public function checkCode($code)
 {
     $res = $this->twofactorAdapter->check($code);
     if ($res) {
         setcookie('twofactorDir-' . $this->dir, $this->cookieCode, 0, "/");
         self::redirect();
     }
     return $res;
 }
 public function testGetUrl()
 {
     $twofactorAdapter = new twofactorAdapter();
     $this->assertNotNull($twofactorAdapter->getURL());
 }