[英]Laravel login limit with specific database record
I'm trying to limit users that have "Request" in the function row of the user table in the database from logging in. 我正在尝试限制在数据库中用户表的功能行中具有“请求”的用户登录。
AuthenticatesUsers.php AuthenticatesUsers.php
protected function attemptLogin(Request $request)
{
return $this->guard()->attempt(
$this->credentials($request), $request->has('remember')
);
}
How would I go about to accomplish this? 我将如何实现这一目标?
if (Auth::attempt([
'email' => $request->email,
'password' => $request->password,
'function' => 'Request'
])) {
//only users matching those 3 criteria will be logged in.
}
In what file does this go? 这是什么文件?
Any controller where you do user login logic (UserController, LoginController, AuthController or whatever you call it). 任何用户登录逻辑的控制器(UserController,LoginController,AuthController或其他任何你称之为的控制器)。
You cannot add this to the default login unless you did it to change it. 除非您更改它,否则无法将其添加到默认登录名。 This is custom/manual autentication.
这是自定义/手动验证。
So i can not restrict people from loggin in with the default authentication from laravel? 所以我不能用laravel的默认身份验证来限制人们登录?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.