auth Login verification no longer uses MD5. How to add an MD5 verification without modifying the source code. Please give a detailed introduction.
认证0级讲师
Is the questioner talking about encrypted passwords?
If yes, you can add this User.php in
User.php
public function setPasswordAttribute($password) { $this->attributes['password'] = md5($password); }
==================================================== ==============
Modified part:
app/
MD5/
(MD5Hasher.php)
class MD5Hasher implements Illuminate/Contracts/Hashing/Hasher { /** * Hash the given value. * * @param string $value * @return array $options * @return string */ public function make($value, array $options = []) { return md5($value); } /** * Check the given plain value against a hash. * * @param string $value * @param string $hashedValue * @param array $options * @return bool */ public function check($value, $hashedValue, array $options = []) { return $this->make($value) === $hashedValue; } /** * Check if the given hash has been hashed using the given options. * * @param string $hashedValue * @param array $options * @return bool */ public function needsRehash($hashedValue, array $options = []) { return false; } }
Command line:
php artisan make:provider MD5HashServiceProvider
Write in the register() method of this file:
register()
public function register() { $this->app['hash'] = $this->app->share(function () { return new MD5Hasher(); }); }
config/app.php, comment the following line:
config/app.php
Illuminate\Hashing\HashServiceProvider::class,
Add yours:
MD5HashServiceProvider::class
Happy Hacking
Is the questioner talking about encrypted passwords?
If yes, you can add this
User.php
in==================================================== ==============
Modified part:
1. In
app/
下创建一个MD5/
文件夹。里面创建一个MD5Hasher类(MD5Hasher.php)
:make your provider
Command line:
Write in the
register()
method of this file:Modify configuration
config/app.php
, comment the following line:Add yours:
Happy Hacking