简体   繁体   中英

LoginThrottles not working in Laravel 5.3

Can someone show me on how to fix this error or any documentation how to use LoginThrottle. I have already read the documentation about Authentication but i dont have idea on how to implement it. Please help me.I'm new in laravel 5.3. Here is my code.

use LoginThrottle;
public function login(){

    $rules = [
        'email'=>'required|email',
        'password'=>'required'
    ];

    $validator = Validator::make(Input::all(),$rules);

    if($validator->fails()){

        return Redirect::to('/signin')->withErrors([$validator->errors()->all() ]);

    }else{

        $data = array(
            'email' => Input::get('email'),
            'password' => Input::get('password')
        );

       // Login::Insert($data);
      //  $checkuser = Login::Login($data);



        if (Auth::attempt($data)) {

            return Redirect::to('/');

        }else{
            return Redirect::to('signin')->withErrors('Invalid username or password');

        }
    }
}

try this code

public function postSignin(Request $request)
{
  $this->validate($request,[
    'email'=>'email|required',
    'password'=>'required'
    ]);
    if(Auth::attempt(['email'=>$request->input('email'),'password'=>$request->input('password')])){
      return redirect()->route('/');
    }else{
 return redirect()->route('/signin')->withErrors('Invalid username or password');
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM