It took a long time to finally fully understand how laravel5.0 was signed in, and it felt very complicated.
For example, when the password field in the database is PWD instead of the system default password, the modified files are:
// \vendor\laravel\framework\src\Illuminate\Auth\Authenticatable.phppublic function getAuthPassword(){// return $this->password; 修改为 return $this->pwd;}
If the add-on method is different, the modified files are:
// \vendor\laravel\framework\src\Illuminate\Auth\EloquentUserProvider.phppublic function validateCredentials(UserContract $user, array $credentials){ $plain = $credentials['password']; // 下面的$this->hasher->check修改为自定义加签后的字符串相等判断 return $this->hasher->check($plain, $user->getAuthPassword());}
Such modification is equivalent to modifying the source code of the Laravel, is not elegant, do not know there is no better way?
Reply content:
It took a long time to finally fully understand how laravel5.0 was signed in, and it felt very complicated.
For example, when the password field in the database is PWD instead of the system default password, the modified files are:
// \vendor\laravel\framework\src\Illuminate\Auth\Authenticatable.phppublic function getAuthPassword(){// return $this->password; 修改为 return $this->pwd;}
If the add-on method is different, the modified files are:
// \vendor\laravel\framework\src\Illuminate\Auth\EloquentUserProvider.phppublic function validateCredentials(UserContract $user, array $credentials){ $plain = $credentials['password']; // 下面的$this->hasher->check修改为自定义加签后的字符串相等判断 return $this->hasher->check($plain, $user->getAuthPassword());}
Such modification is equivalent to modifying the source code of the Laravel, is not elegant, do not know there is no better way?
You can also make your own login registration AH. But I think the bring-on has been very useful.
If you add a field to the user table to get the value of the field, you canauth()->user()->你的字段名