Beispiel #1
0
 public function onsubmit($sender)
 {
     $this->setError('');
     if ($this->_login == '') {
         $this->setError('Введите логин');
     } else {
         if ($this->_password == '') {
             $this->setError('Введите пароль');
         }
     }
     if (strlen($this->_login) > 0 && strlen($this->_password)) {
         $user = Helper::login($this->_login, $this->_password);
         if ($user instanceof User) {
             System::setUser($user);
             $_SESSION['user_id'] = $user->user_id;
             //для  использования  вне  Application
             $_SESSION['userlogin'] = $user->userlogin;
             //для  использования  вне  Application
             //App::$app->getResponse()->toBack();
             if ($this->loginform->remember->isChecked()) {
                 $_config = parse_ini_file(_ROOT . 'config/config.ini', true);
                 setcookie("remember", $user->user_id . '_' . md5($user->user_id . $_config['common']['salt']), time() + 60 * 60 * 24 * 30);
             }
             @mkdir(_ROOT . UPLOAD_USERS . $user->user_id);
             \ZippyERP\System\Util::removeDirRec(_ROOT . UPLOAD_USERS . $user->user_id . '/tmp');
             @mkdir(_ROOT . UPLOAD_USERS . $user->user_id . '/tmp');
             App::RedirectHome();
         } else {
             $this->setError('Неверный  логин');
         }
     }
     $this->_password = '';
 }
Beispiel #2
0
 public function onsubmit($sender)
 {
     $this->setError('');
     if ($this->_login == '') {
         $this->setError('Введите логин');
     } else {
         if ($this->_password == '') {
             $this->setError('Введите пароль');
         } else {
             if ($this->_confirm == '') {
                 $this->setError('Подтвердите пароль');
             } else {
                 if ($this->_confirm != $this->_password) {
                     $this->setError('Неверное подтверждение');
                 } else {
                     if ($user = Helper::login($this->_login) != false) {
                         $this->setError('Логин уже существует');
                     }
                 }
             }
         }
     }
     if (!$this->isError()) {
         $user = new User();
         $user->userlogin = $this->_login;
         $user->userpass = \password_hash($this->_password, PASSWORD_DEFAULT);
         $user->Save();
         App::Redirect('\\ZippyERP\\System\\Pages\\UserInfo', $user->user_id);
     }
     $this->_confirm = '';
     $this->_password = '';
 }
Beispiel #3
0
 public function OnSubmit($sender)
 {
     $roles = array();
     $rows = $this->roleform->rolerow->getDataRows();
     foreach ($rows as $row) {
         $ch = $row->getChildElement('role');
         if ($ch->isChecked()) {
             $roles[] = $row->getDataItem()->role_id;
         }
     }
     \ZippyERP\System\Helper::saveRoles($this->user->user_id, $roles);
 }