vendredi 15 novembre 2019

Password reset in Laravel(5.5) by email or mobile

By default Laravel (5.5)'s password reset system works on email, but i need to bring support for mobile number (verify by OTP and generate a token and redirect to password reset page). I am doing all this part and i create a mobile column on password_resets table.

But the problem is \Illuminate\Auth\Passwords\DatabaseTokenRepository && \Illuminate\Auth\Passwords\TokenRepositoryInterface ON exist method and it doesn't seem configurable.

public function exists(CanResetPasswordContract $user, $token)
{
    $record = (array) $this->getTable()->where(
        'email', $user->getEmailForPasswordReset()
    )->first();

    return $record &&
           ! $this->tokenExpired($record['created_at']) &&
             $this->hasher->check($token, $record['token']);
}

I need to override that method. There's so much inheritance going on. What classes do I need to extend and how to override that method.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire