vendredi 1 janvier 2016

Laravel 5.1 auth logs out after refresh

I'm working with Laravel for the first time. My auth user logs out automatically after i go to another route or if i refresh the page, and i dont understand why, please help me.

This is my log in code:

public function ini_ses(Request $datos)
{
    //Inicia sesion
    Session::put('ses_correo', Input::get('email'));

    $correo = $datos->input('email');
    $password= $datos->input('password');

    if(Auth::attempt(['correo_elec'=>$correo, 'password'=>$password]))
    {
        $_session['correo']=$correo;
        $_session['contra']=$password;

        if(Auth::user()->tipo==0)
        {
            return view('cliente');
        }
        elseif(Auth::user()->tipo==1)
        {
            return view('veterinario');
        }
        elseif(Auth::user()->tipo==2)
        {
            echo("Admin");
        }
    }
    else
    {
        var_dump($correo, $password);
    }

}

If you know how to fix it, i aprecciate your help.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire