【发布时间】:2018-06-15 15:17:37
【问题描述】:
在 Laravel 5.4 中,有没有办法将密码重置链接发送到单独的身份验证保护而不是默认的。我正在使用默认的 PasswordResetController 以这种方式完成工作
public function company(Request $request)
{
$this->validate(request(), [
'email' => 'required|email',
]);
$response = Password::sendResetLink([
'email' => $request->email
]);
//overridden if condition
if($response == "passwords.sent")
{
return back()->with('message','Password reset link has been sent, please check your email');
}
return back()->with('message', 'No such email address in our records, try again');
}
sendResetLink() 方法检查并将重置链接发送到默认守卫,但我在 auth.php 中定义了一个名为 web 的新守卫
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'companies',
],
sendResetLink方法是这样的
public function sendResetLink(array $credentials)
{
// First we will check to see if we found a user at the given credentials and
// if we did not we will redirect back to this current URI with a piece of
// "flash" data in the session to indicate to the developers the errors.
$user = $this->getUser($credentials);
if (is_null($user)) {
return static::INVALID_USER;
}
此方法有什么方法可以签入单独的表或使用单独的身份验证保护?
【问题讨论】:
-
你能解释一下你的情况吗?如果没有你介绍的代码,你真的想做什么,因为我想你做错了什么,人们为了帮助解决这个问题而无法正确理解你?
标签: php laravel authentication laravel-5 laravel-5.4