简体   繁体   English

LoginThrottles在Laravel 5.3中不起作用

[英]LoginThrottles not working in Laravel 5.3

Can someone show me on how to fix this error or any documentation how to use LoginThrottle. 有人可以告诉我如何修复此错误或任何文档如何使用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. 请帮助我。我是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');
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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