public function run()
 {
     if ($this->registry->get('user')->isUserLoggedIn()) {
         RegistryFactory::start('cookie')->remove('userSession');
         RegistryFactory::start('session')->remove('userSession');
     }
     Server::setReferData(['search' => Server::getReferData()['search']]);
     Server::headerLocationReferer();
 }
Exemple #2
0
 public function run()
 {
     $adminMail = RegistryFactory::start('file')->register('Conf\\Conf')->getAdminEmail();
     $transport = \Swift_MailTransport::newInstance();
     $message = \Swift_Message::newInstance()->setSubject('Message from CMS')->setFrom($this->http->request->get('from'))->setTo($adminMail)->setBody($this->http->request->get('body'));
     $mailer = \Swift_Mailer::newInstance($transport);
     $mailer->send($message);
     Server::setReferData(['send' => 1]);
     Server::headerLocationReferer();
 }
Exemple #3
0
 /**
  *
  * @param Command $command
  */
 private function savePassword(Command $command)
 {
     $hash = $command->entity()->getPassword();
     if (!HashPass::verifyPassword($this->http->request->get('userPassword'), $hash)) {
         Server::setReferData(['error' => ['validPassword' => 1]]);
         Server::headerLocationReferer();
     } else {
         $command->setPassword($this->http->request->get('userNewPassword'))->update(['password' => []]);
     }
 }
 public function run()
 {
     Server::setReferData(['form' => 'registration']);
     if ($this->registry->get('user')->isUserLoggedIn()) {
         Server::setReferData(['error' => ['userMustBeLogout' => 1]]);
         Server::headerLocationReferer();
     }
     $this->login = $this->http->request->get('userLogin');
     $this->email = $this->http->request->get('userEmail');
     $this->password = $this->http->request->get('userPassword');
     $controller = new Command(new Users());
     $controller->setLogin($this->login)->setEmail($this->email)->setPassword($this->password)->setRegDate(new \DateTime('now'))->setLogDate(new \DateTime('now'))->setRole('user')->insert(['login' => ['unique'], 'email' => ['unique'], 'password' => []]);
     $this->sendMail();
     Server::setReferData(['registrationSuccess' => 1]);
     Server::headerLocationReferer();
 }
Exemple #5
0
 public function run()
 {
     if ($this->registry->get('user')->isUserLoggedIn()) {
         Server::headerLocationReferer();
     }
     $this->login = $this->http->request->get('userLogin');
     $this->column = $this->isEmail($this->login) ? 'email' : 'login';
     $this->password = $this->http->request->get('userPassword');
     $this->remember = $this->http->request->get('userRemember', null);
     $userId = $this->getUserId();
     if ($userId === 0) {
         Server::setReferData(['form' => 'login', 'error' => ['valid' . ucfirst($this->column) . '_or_password' => 1]]);
         Server::headerLocationReferer();
     } else {
         $controller = new Command(new Users());
         $controller->find($userId)->setLogDate(new \DateTime('now'))->update();
         $this->setSession();
         Server::headerLocationReferer();
     }
 }
 public function run()
 {
     Server::setReferData(['form' => 'remind']);
     if ($this->registry->get('user')->isUserLoggedIn()) {
         Server::headerLocationReferer();
     }
     $controller = new Command(new Users());
     $controller->findOneBy(['email' => $this->http->request->get('userEmail')]);
     if ($controller->entity() === null) {
         // If email not exists
         Server::setReferData(['error' => ['findEmail' => 1]]);
         Server::headerLocationReferer();
     } else {
         $this->setRandomPasword();
         $this->updatePassword($controller);
         $this->sendMail($controller);
         Server::setReferData(['remindSuccess' => 1]);
         Server::headerLocationReferer();
     }
 }
Exemple #7
0
 private function sendErrorsIfExists()
 {
     if (count($this->errorArray)) {
         foreach ($this->command->entitySettersArray as $key => $data) {
             // Repleca reference entities instances to its referenced id
             if (is_object($data)) {
                 if (method_exists($data, 'getId')) {
                     $this->command->entitySettersArray[$key] = $data->getId();
                 } else {
                     unset($this->command->entitySettersArray[$key]);
                 }
             }
         }
         Server::setReferData(array('data' => $this->command->entitySettersArray, 'error' => $this->errorArray));
         Server::headerLocationReferer();
     }
 }
Exemple #8
0
 private function setSearchToReferData()
 {
     Server::setReferData(['search' => $this->search]);
     Server::setRefererSession();
 }