Exemple #1
0
 public function SignOnFormSubmitted(NAppForm $form)
 {
     // Login form submitted
     try {
         $this->user->login($form['name']->getValue(), $form['password']->getValue());
         $this->user->setExpiration(30 * 60, TRUE, TRUE);
         // set expiration 30 minuts
         if (ACL_CACHING) {
             unset($this->cache['gui_acl']);
             // invalidate cache
         }
         $this->redirect('Default:');
     } catch (NAuthenticationException $e) {
         $form->addError($e->getMessage());
         $form->setValues(array('name' => ''));
     }
 }
Exemple #2
0
 public function deleteOnFormSubmitted(NAppForm $form)
 {
     if ($form['delete']->isSubmittedBy()) {
         try {
             $id = $this->getParam('id');
             dibi::query('DELETE FROM [' . TABLE_ROLES . '] WHERE id=%i;', $id);
             $this->flashMessage('The role has been deleted.', 'ok');
             if (ACL_CACHING) {
                 unset($this->cache['gui_acl']);
                 // invalidate cache
             }
             $this->redirect('Roles:');
         } catch (Exception $e) {
             $form->addError('The role has not been deleted.');
             throw $e;
         }
     } else {
         $this->redirect('Roles:');
     }
 }
Exemple #3
0
 public function kontrolaMailu(NAppForm $form)
 {
     $values = $form->getValues();
     if ($values->email && !$this->osobyRepository->zkontrolovatDostupnostMailu($values->email)) {
         $form->addError('Shodnou e-mailovou adresu může mít maximálně 5 osob. Zadejte jinou adresu.');
     }
 }