[英]Laravel : Password reset email check against user
I have the following code to send the password reset email to the users email which is working: 我有以下代码将密码重置电子邮件发送到正在工作的用户电子邮件:
$response = $this->passwords->sendResetLink($request->only('email'),function($message)
{
$message->subject('Password Reminder');
});
What i want is that user should write their username
instead of email, And i will check the email against that username , And will send the email.So i came up with this idea. 我想要的是用户应该
username
而不是电子邮件,然后我将对照该用户名检查电子邮件,并发送email.So,我想到了这个主意。
$usernameToEmail = User::where('name','=', Input::get('username'))->first();
$response = $this->passwords->sendResetLink(['name' => $usernameToEmail],function($message)
{
$message->subject('Password Reminder');
});
Which is not working also. 这也不起作用。
Am i missing something ? 我想念什么吗?
You're close, but your $usernameToEmail
variable contains a User
object, not an email string. 您接近了,但是您的
$usernameToEmail
变量包含一个User
对象,而不是一个电子邮件字符串。 Most likely you just need to add a method to your chain: 您很可能只需要向链中添加一个方法:
$usernameToEmail = User::where('name','=', Input::get('username'))->first()->email;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.