public function loginAction() { $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $this->assets->collection('admin-login-css')->addCss(__DIR__ . '/../assets/login.css')->setLocal(true)->addFilter(new \Phalcon\Assets\Filters\Cssmin())->setTargetPath(PUBLIC_PATH . '/assets/admin-login.css')->setTargetUri('assets/admin-login.css'); $form = new LoginForm(); if ($this->request->isPost()) { if ($form->isValid($this->request->getPost())) { $login = $this->request->getPost('login', 'string'); $password = $this->request->getPost('password', 'string'); $user = AdminUser::findFirst("login='******'"); if ($user) { if ($user->checkPassword($password)) { if ($user->isActive()) { $this->session->set('auth', $user->getAuthData()); $this->flash->success($this->helper->translate("Wellcome to adminpanel")); $this->response->redirect('admin'); return $this->response->send(); } else { $this->flash->error($this->helper->translate("User isn't active")); } } else { $this->flash->error($this->helper->translate("Wrong login/password")); } } else { $this->flash->error($this->helper->translate("user not found Wrong login/password")); } } else { foreach ($form->getMessages() as $message) { $this->flash->error($message); } } } }
public function loginAction() { $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $form = new LoginForm(); if ($this->request->isPost()) { if ($form->isValid($this->request->getPost())) { $login = $this->request->getPost('login', 'string'); $password = $this->request->getPost('password', 'string'); $user = AdminUser::findFirst("login='******'"); if ($user) { if ($user->checkPassword($password)) { if ($user->isActive()) { $this->session->set('auth', $user->getAuthData()); $this->flash->success($this->helper->translate("Приветствуем в административной панели управления!")); $this->response->redirect('admin'); return $this->response->send(); } else { $this->flash->error($this->helper->translate("Пользователь не активирован")); } } else { $this->flash->error($this->helper->translate("Неверный логин или пароль")); } } else { $this->flash->error($this->helper->translate("Неверный логин или пароль")); } } else { foreach ($form->getMessages() as $message) { $this->flash->error($message); } } } }
public function loginAction() { $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); $form = new LoginForm(); if ($this->request->isPost()) { if ($this->security->checkToken()) { if ($form->isValid($this->request->getPost())) { $login = $this->request->getPost('login', 'string'); $password = $this->request->getPost('password', 'string'); $user = AdminUser::findFirst("login='******'"); if ($user) { if ($user->checkPassword($password)) { if ($user->isActive()) { $this->session->set('auth', $user->getAuthData()); $this->flash->success($this->helper->translate("Welcome to the administrative control panel!")); return $this->redirect($this->url->get() . 'admin'); } else { $this->flash->error($this->helper->translate("User is not activated yet")); } } else { $this->flash->error($this->helper->translate("Incorrect login or password")); } } else { $this->flash->error($this->helper->translate("Incorrect login or password")); } } else { foreach ($form->getMessages() as $message) { $this->flash->error($message); } } } else { $this->flash->error($this->helper->translate("Security errors")); } } $this->view->form = $form; }