2016-06-14 39 views
0

我想要使用我通過php php artisan make:auth獲得的表password_resets,但是此表使用「email」,這是不正確的,因爲如果我的用戶更改他們的電子郵件在他們的個人資料,然後是找出他們的問題,我想用「ID用戶」表「password_resets」,而不是「電子郵件」。我如何使用密碼重置(laravel 5.2)中的idUser

我在哪裏可以更改此代碼????

回答

0

謝謝您的回答, 終於解決了我這樣做:

Dirección:...供應商/ 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(); 
} 
0

當用戶嘗試重置電子郵件時,他必須提供重置電子郵件,並且如果他/她更改了電子郵件的配置文件,新電子郵件將自動更新在用戶表或任何您擁有的權利?因此用戶提供更新的電子郵件,如果他/她真的打算重新最新的電子郵件將被用於密碼重置和電子郵件的更新不應該是一個問題,在所有的password.so。 :) :)