我怎样才能在password_resets中使用idUser(laravel 5.2)

时间:2016-06-14 14:36:46

标签: php laravel laravel-5.2

我想使用我用comand php artisan make:auth获得的表password_resets,但是这个表使用“email”,这不对,因为如果我的用户在他们的个人资料中更改了他们的电子邮件,那么就是一个问题。识别它们,我想使用“ password_resets ”表中的“ idUser ”而不是“电子邮件”。

我在哪里可以更改代码????

2 个答案:

答案 0 :(得分:0)

当您的用户尝试重置电子邮件时,他必须提供重置电子邮件,如果他/她更改了配置文件中的电子邮件,新电子邮件将自动更新用户表或其他你有权利?因此,如果他/她真的打算重置密码,用户将提供更新的电子邮件。因此,最新的电子邮件将用于密码重置,并且电子邮件的更新应该不是问题。 :):)

答案 1 :(得分:0)

谢谢你的回答, 最后我解决了这个问题:

Dirección:... vendor / laravel / .... DatabaseTokenRepository.php

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

    $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($idUser, $email, $token)); //Aquí he añadido el idUser

    return $token;
}

/**
 * Delete all existing reset tokens from the database.
 *
 * @param  \Illuminate\Contracts\Auth\CanResetPassword  $user
 * @return int
 */
protected function deleteExisting(CanResetPasswordContract $user)
{
    return $this->getTable()->where('idUser', $user->idUser)->delete(); 
}
相关问题