我已将用户表格电子邮件更改为user_email
,密码更改为user_password
。
我正在使用laravel的默认make:auth
。登录功能正常但发送重置密码电子邮件总是检查电子邮件字段并给出和错误
路线
Route::group(['middleware' => ['web']], function() {
// Login Routes...
Route::get('/','Auth\LoginController@showLoginForm');
Route::post('/login','Auth\LoginController@login');
Route::get('/logout','Auth\LoginController@logout');
// Password Reset Routes...
Route::get('password/reset','Auth\ForgotPasswordController@showLinkRequestForm');
Route::post('password/email','Auth\ForgotPasswordController@sendResetLinkEmail');
Route::get('password/reset/{token}','Auth\ResetPasswordController@showResetForm');
Route::post('password/reset','Auth\ResetPasswordController@reset');
});
用户模型
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Notifications\PasswordResetNotification;
class User extends Authenticatable
{
use Notifiable;
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'rdams_employee';
protected $primaryKey = 'user_id';
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'user_password', 'remember_token',
];
// Override required, otherwise existing Authentication system will not match credentials
public function getAuthPassword()
{
return $this->new_password;
}
public function getResetPassword()
{
return $this->new_password;
}
/**
* Get the e-mail address where password reset links are sent.
*
* @return string
*/
public function getEmailForPasswordReset()
{
return $this->user_email;
}
/**
* Overriding the exiting sendPasswordResetNotification so that I can customize it
*
* @var array
*/
public function sendPasswordResetNotification($token)
{
$this->notify(new PasswordResetNotification($token));
}
}
如果我将user_email
更改为电子邮件,一切正常。但需要将电子邮件用作user_email
由于