public function indexAction() { $data['title'] = 'Đăng Nhập Hệ Thống'; $data['notification'] = ''; $nameAdmin = $this->app['session']->get('adminName', '1'); if ($nameAdmin != 1) { return $this->redirect('adminhome'); } if ($this->getPostData("login")) { $postData = $this->getPostData(); if (Auth::checkLogin($postData) != Null) { echo "<script>alert('Đăng nhập thành công !')</script>"; $dataget = Auth::checkLogin($postData); $Name = $dataget['name']; $this->app['session']->set("adminName", $Name); $nameAdmin = $this->app['session']->get('adminName', 'Null'); return $this->redirect('adminhome'); } if (Auth::checkLogin($postData) == false) { $data['notification'] = 'Đăng nhập thất bại vui lòng kiểm tra lại !'; return $this->render('admin/auth/login.html.twig', $data); } } return $this->render('admin/auth/login.html.twig', $data); }
public function deleteUserById($id) { $user = Auth::where("id", "=", $id)->delete(); if ($user) { return true; } return false; }
public function checkLogin($postData) { $email = $postData['email']; $password = $postData['password']; $user = Auth::where('email', '=', $email)->first(); if ($user && $user->password == md5($password) && $user->role_id == 1) { return $user; } return false; }