Example #1
0
 /**
  * 
  * 
  */
 public function handleAuthenticationRequest(&$message, $conf)
 {
     if ($this->app->request()->isFormData() and !$this->app->request()->isXhr()) {
         if ($this->app->request()->post('username') and $this->app->request()->post('password')) {
             $username = $this->app->request()->post('username');
             $pass = $this->app->request()->post('password');
             $passCompare = $conf['raptor']['adminpass'];
             $obj = \Raptor\Configuration\ConfigurationLoader::getHash($passCompare);
             if ($obj->valid) {
                 $passCompare = \Raptor\Security\SecureHash::verify($pass, $obj->password);
             } else {
                 $passCompare = $pass === $conf['raptor']['adminpass'];
             }
             if ($conf['raptor']['admin'] == $username and $passCompare) {
                 $this->app->getSession()->set('admin_auth', true);
                 $this->app->getSession()->set('admin_auth_user', $username);
                 $this->app->redirect('');
             } else {
                 $message = "Wrong password or username";
             }
         } else {
             $message = "Wrong password or username";
         }
     }
 }