Esempio n. 1
0
 /**
  * Do username/password check here
  *
  * @param $user
  * @param $password
  * @param $remember
  * @return bool
  * @throws Kohana_Exception
  */
 protected function _login($user, $password, $remember)
 {
     if (!is_array($user)) {
         $user = Model_Manager::getManager(['login' => strtoupper($user)]);
     }
     if (is_string($password)) {
         // Create a hashed password
         $password = $this->hash($password);
     }
     // If the passwords match, perform a login
     if (empty($user['PASSWORD']) || $user['PASSWORD'] !== $password) {
         Messages::put('Неправильный логин или пароль', 'error');
         return false;
     }
     if ($user['AGENT_STATE'] != 1) {
         Messages::put('Доступ запрещен', 'error');
         return false;
     }
     if ($user['STATE_ID'] != 1) {
         Messages::put('Доступ запрещен', 'error');
         return false;
     }
     // Finish the login
     $this->complete_login($user);
     $db = Oracle::init();
     $data = ['p_manager_id' => $user['MANAGER_ID'], 'p_params' => $_SERVER['HTTP_USER_AGENT'] . ';' . $_SERVER['REMOTE_ADDR']];
     $db->procedure('auth_user', $data);
     return true;
 }
Esempio n. 2
0
 /**
  * добавление менеджера
  */
 public function action_add_manager()
 {
     $params = $this->request->post('params');
     $newManagerId = Model_Manager::addManager($params);
     if (empty($newManagerId)) {
         $this->jsonResult(false);
     }
     $this->jsonResult(true, Model_Manager::getManager($newManagerId));
 }
Esempio n. 3
0
 /**
  * а вот тут уже аяксово получаем инфу по конкретному менеджеру
  */
 public function action_manager()
 {
     $managerId = $this->request->param('id');
     $manager = Model_Manager::getManager($managerId);
     if (empty($manager)) {
         $this->html('<div class="error_block">Ошибка</div>');
     }
     $managerSettingsForm = View::factory('forms/manager/settings');
     $managerSettingsForm->set('manager', $manager)->set('width', 100)->set('reload', 0)->set('changeRole', 1);
     $popupManagerAddClients = Common::popupForm('Добавление клиентов', 'manager/add_clients');
     $html = View::factory('ajax/control/manager')->bind('managerId', $managerId)->bind('manager', $manager)->bind('managerSettingsForm', $managerSettingsForm)->bind('popupManagerAddClients', $popupManagerAddClients);
     $this->html($html);
 }