I've implemented Laravel's standard password reset functionality in my app. It works nicely except that I'm getting 2 "reset password" emails in my inbox. (Side note that might not mean anything: one of the emails doesn't have a subject line and the other does.) I don't think I'm doing anything out of the ordinary so I'm stumped. Any ideas?
public function getRemind(){
    $view = View::make('password.remind');
    $view->title = 'my title';
    return $view;
}
form on remind.blade.php
{{ Form::open(array('url'=>'do-reset')) }}
        <fieldset>
            <label for="email">Email Address</label>
            {{ Form::email('email', $email, array('id'=>'email')) }}
            <div id="button_wrap">
                <input type="submit" id="submit" name="submit" value="Send Reset Email">
            </div>
        </fieldset>
        @if(Session::has('status'))
            <p>{{ Session::get('status') }}</p>
        @endif
        @if(Session::has('error'))
            <p>{{ Session::get('error') }}</p>
        @endif
    {{ Form::close() }}
Route for do-reset:
Route::post('do-reset', array('uses'=>'RemindersController@postRemind'));
I haven't changed anything in the postRemind() method:
public function postRemind(){
    Password::remind(Input::only('email'), function($message){
        $message->subject('Click on the link below to reset your password.');
    });
    switch ($response = Password::remind( Input::only('email') ) ){
        case Password::INVALID_USER:
            return Redirect::back()->with('error', Lang::get($response));
        case Password::REMINDER_SENT:
            return Redirect::back()->with('status', Lang::get($response));
    }
}
                As you can probably see the Password::remind() function is being called twice.
I would change the code to something like this:
public function postRemind()
{
    $response = Password::remind(Input::get('email'), function($message) {
        $message->subject('Click on the link below to reset your password.');
    });
    switch ($response) {
        case Password::INVALID_USER:
            return Redirect::back()->with('error', Lang::get($response));
        case Password::REMINDER_SENT:
            return Redirect::back()->with('status', Lang::get($response));
    }
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With