how does resetpasswordcontroller work with laravel’s password reset table?

Checkout /vendor/laravel/framework/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php

This is the default class that implements the TokenRepositoryInterface and is used by the /vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBroker.php.

Inside this class you can find all the actual functionality that handles the password resets including the table operations you mention. For example, one method you’ll find is:

/**
 * Create a new token record.
 *
 * @param  \Illuminate\Contracts\Auth\CanResetPassword  $user
 * @return string
 */
public function create(CanResetPasswordContract $user)
{
    $email = $user->getEmailForPasswordReset();

    $this->deleteExisting($user);

    // We will create a new, random token for the user so that we can e-mail them
    // a safe link to the password reset form. Then we will insert a record in
    // the database so that we can verify the token within the actual reset.
    $token = $this->createNewToken();

    $this->getTable()->insert($this->getPayload($email, $token));

    return $token;
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top