I configured laravel 5.1 according to mail docs. Sending mail works fine.
Next step was to add the reset password according to resetting passwords docs. Here I struggle to send the link to the reset-password formular.
Seems like the function to send the reset mail is not triggered. I checked as well with the config/mail.php
configuration pretend = true;
. There was no entry in the logfile, that a email was send.
Somehow its as well hard to debug, as I could not find the function where the reset email is triggered.
- How do I send the reset password with mailgun?
- Where is the function locate to send the reset password, or where can I overwrite it, to test it?
This are my configurations:
.env
# ...
MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mail.org
MAIL_PORT=587
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAILGUN_DOMAIN=mg.foo.com
MAILGUN_SECRET=key-foobar.etc
# ....
config/service.php
//...
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
],
//...
config/mail.php
// ...
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => 'foo@test.com', 'name' => 'foo'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'pretend' => false,
// ...
app/Http/routes.php
// ...
Route::group([
'prefix' => LaravelLocalization::setLocale(),
'middleware' => [ 'localeSessionRedirect', 'localizationRedirect' ]
], function() {
//Route::controllers([ 'password' => 'Auth\PasswordController', ]);
// works only if the user is logged out!!!1
// Password reset link request routes...
Route::get('password/email', 'Auth\PasswordController@getEmail');
Route::post('password/email', 'Auth\PasswordController@postEmail');
// Password reset routes...
Route::get('password/reset/{token}', 'Auth\PasswordController@getReset');
Route::post('password/reset', 'Auth\PasswordController@postReset');
});
//...
resources/views/auth/password.blade.php
@extends('layout')
@section('content')
<div class="container">
<form method="POST" action="/password/email">
{!! csrf_field() !!}
@if (count($errors) > 0)
<ul>
@foreach ($errors->all() as $error)
<li></li>
@endforeach
</ul>
@endif
<div class="row">
<div class="col-md-6">
{!! Form::label('email', trans( 'mes.email' )) !!}
<input type="email" name="email" value="" class="form-control">
</div>
<div class="col-md-8">
<button type="submit" class="btn">
Send Password Reset Link
</button>
</div>
<div>
</form>
</div>
@endsection
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire