Laravel 4 reset password: send multiple letters

My application has a standard version of Laravel reset. It works well, except that I get 2 "reset passwords" in my inbox. (A side note, which may mean nothing: one of the letters has no subject, and the other has.) I do not think I'm doing something unusual, so I'm at a dead end. Any ideas?

public function getRemind(){
    $view = View::make('password.remind');
    $view->title = 'my title';

    return $view;
}

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 have not 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));
    }
}
+4
source share
1 answer

As you can see, the function Password::remind()is 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));
    }
}
+7
source

Source: https://habr.com/ru/post/1537400/


All Articles