Beispiel #1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     //Como no funcionaba el Auth, hice uno propio y modifique unas cosillas
     if (MyAuth::check()) {
         //Aca algo voy a hacer
         //Levanto los datos el usuario
     } else {
         return Redirect::to('/');
     }
     //return false;
     //Aca no hace nada
     /*	if ($this->auth->guest())
     		{
     			if ($request->ajax())
     			{
     				return response('Unauthorized.', 401);
     			}
     			else
     			{
     				return redirect()->guest('auth/login');
     			}
     		}
     	*/
     return $next($request);
 }
Beispiel #2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     //Si la session expiro, chequeo si tiene la variable laravel_session
     //|| empty(MyAuth::check() )
     if (empty(Cookie::get('laravel_session')) || empty(MyAuth::check())) {
         return redirect('/');
     }
     return $next($request);
 }
Beispiel #3
0
 public function doLogin()
 {
     $input = Request::all();
     /*$credenciales = DB::table('users')
     	            ->select('*')
     	            ->where('email', '=', $input['email'])
     	            ->get(); 
     		*/
     //  $success = false;
     //  if($credenciales[0]->password == md5($input['password'])) $success = true;
     $userdata = array('email' => $input['email'], 'password' => $input['password']);
     /* 		$id_sesion = md5(uniqid(rand(), true));
     		$id_sesion2 = $input['email']."%".$id_sesion."%".'190.1.1.1';
     		setcookie('id_sesion', $id_sesion2, time()+7776000,'/');
     */
     // attempt to do the login
     if (MyAuth::attempt($userdata)) {
         return Redirect::to('bienvenido');
     } else {
         return Redirect::to('/');
     }
 }