コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: Auth.php プロジェクト: ngnamuit/mini-ecommerce
 public function deleteUserById($id)
 {
     $user = Auth::where("id", "=", $id)->delete();
     if ($user) {
         return true;
     }
     return false;
 }
コード例 #3
0
ファイル: Auth.php プロジェクト: nhung530/sifoni-framework
 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;
 }