laravel 默认用的登录密码加密方式是:
$password = Hash::make('password');
修改密码加密方式为:
$password = md5('password'.'salt');
打开/vender/laravel/framework/src/illuminate/Auth,修改 EloquentUserProvider.php文件
public function validateCredentials(UserContract $user, array $credentials) { $plain = $credentials['password']; $authPassword = $user->getAuthPassword(); $authSalt = $user->getAuthSalt(); return $authPassword === md5($plain.$authSalt); // return $this->hasher->check($plain, $user->getAuthPassword()); }
修改 Illuminate\Contracts\Auth\Authenticatable ,添加接口方法
public function getAuthSalt();
User.php实现此方法
public function getAuthSalt() { return $this->salt; }