jeudi 2 février 2017

I want to prevent from going back to login page , when im already login.

how can i supposed to do that? i think i miss some queries . I hope you guys can help me with this. How to prevent user from going back to the login-page after successful login using back button . Because when I login in and pressed back im going back to my login page. Need help everyone. im using laravel framework

 public function login(Request $req)
            {
                $username=$req->input('email');
                $password=$req->input('password');
                $breadcrumb = 'Dashboard';
                $pageTitle = 'CollabUX | Dashboard';
                $prepath ='../';
                $currentURL = Req::url();

                $user = DB::table('add_users')->where(['username'=>$username,'password'=>$password])->get();    

                if(count($user)>0){
                // Store a piece of data in the session...
                session(['isloggedin' => 'true']);
                return View::make('dashboard')->with(
                    array('breadcrumb' => $breadcrumb,'pageTitle' => $pageTitle,'currentURL' => $currentURL,'prepath' => $prepath));

                }
                else{
                    //imbes na empty page, redirect ka ulit sa login page
                    $data = array(
                        'error'  => 1,
                        'remarks' => 'Invalid Username/Password. Please try again.'
                    );
                    return View::make('login')->with('data', $data);
                }      
            }



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2l0khoc
via IFTTT

Aucun commentaire:

Enregistrer un commentaire