How do I send the password reset link to the users email when they click on password reset button.
I have a form
<form action="/company/password/reset/" method="POST">
{{ csrf_field() }}
<div class="row">
<div class="input-field col s12">
<input placeholder="Enter your email" id="emails" type="email" class="validate" required name="email">
<label for="emails">E-mail Address</label>
</div>
</div>
<p><button type="submit" method="post">SUBMIT</button></p>
</form>
Routes
Route::post('/password/company/reset/', 'PasswordResetController@company');
And controller
public function company($email)
{
$company = $request->email;
Password::sendResetLink(['email' => $company]);
}
It's not working right now, is this the correct way to do it??
I cannot find any tutorial covering reset password in laravel 5.4
I get this error:
User must implement CanResetPassword interface.
If your form's action is /company/password/reset/
, the route should be defined as
Route::post('/password/company/reset/','PasswordResetController@company');
The form's input can be retrieved in the controller as following:
public function company(Request $request) {
$email = $request->email;
...
The documentation explicitly says:
To get started, verify that your
App\\User
model implements theIlluminate\\Contracts\\Auth\\CanResetPassword
contract. Of course, theApp\\User
model included with the framework already implements this interface, and uses theIlluminate\\Auth\\Passwords\\CanResetPassword
trait to include the methods needed to implement the interface.
Since you have some custom user model, you need to implement this contract in order to use Password::sendResetLink
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.