Пример #1
0
 /**
  * Autenticates the User
  */
 function onLogin()
 {
     try {
         TTransaction::open('liger');
         $data = $this->form->getData('StdClass');
         $this->form->validate();
         $user = SystemUser::autenticate($data->login, $data->password);
         if ($user) {
             $programs = $user->getPrograms();
             $programs['LoginForm'] = TRUE;
             TSession::setValue('logged', TRUE);
             TSession::setValue('login', $data->login);
             TSession::setValue('username', $user->name);
             TSession::setValue('frontpage', '');
             TSession::setValue('programs', $programs);
             $frontpage = $user->frontpage;
             if ($frontpage instanceof SystemProgram and $frontpage->controller) {
                 TApplication::gotoPage($frontpage->controller);
                 // reload
                 TSession::setValue('frontpage', $frontpage->controller);
             } else {
                 TApplication::gotoPage('EmptyPage');
                 // reload
                 TSession::setValue('frontpage', 'EmptyPage');
             }
         }
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
         TSession::setValue('logged', FALSE);
         TTransaction::rollback();
     }
 }