O
O
ObehanProger2020-06-21 21:01:01
Laravel
ObehanProger, 2020-06-21 21:01:01

Why doesn't the password_resets table populate and why can't I change the password for some users?

1. When resetting a password, no entries appear in the password_resets table. Although all methods are standard and not overridden. But the password is changing. In what place is this token generally generated, entered into the table and checked? What method/class makes an entry in this table?
2. Users registered via social networks and without a password (the password and token fields in the users table are empty) cannot change the password. Throws a strange validation error under the email: 'passwords.token' field, which is not present in the resources/lang/en files. Where does this error come from and how to fix it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
ObehanProger, 2020-06-24
@ObehanProger

1. An entry in the password_resets table is made immediately after sending a notification and a link to change the password. And after changing the password, this entry is deleted. Thus, for one email in the table there cannot be more than one record at the same time. The token is generated in Illuminate\Auth\Passwords\DatabaseTokenRepository:

<br>
public function create(CanResetPasswordContract $user)<br>
    {<br>
        $email = $user->getEmailForPasswordReset();<br>
        $this->deleteExisting($user);<br>
        $token = $this->createNewToken();<br>
        $this->getTable()->insert($this->getPayload($email, $token));<br>
        return $token;<br>
    }<br>

2. When creating a user from a social network, you need to generate a token and insert it into the users table

D
Daria Motorina, 2020-06-21
@glaphire

1. Go to the password reset page, open devtools > network, click "reset password", look at the URL that worked during the reset and through IDE > "search the entire project" look for the URL, and then the action where this logic is described, further xdebug
UPD. The doc describes where to look ( link )
2. IDE > "search the entire project" > somewhere in the vendor files there will be this error message, which means that this validation works earlier than the validation at the password change level

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question