How to import md5 salt passwords from symfony to laravel 4 -
the user table old symfony system has following columns:
email | algorithm | salt | password --------------------+-------------+-----------------------------------+------------- techytimo@gmail.com | sha1 | ea579e44dd150e5ba6680d6a3cee26b4 | f48598ad17acf18583d8499d7c6abc430929ae49
the new system created laravel 4 has following columns:
email | password --------------------+----------------------------------------------------------- techytimo@gmail.com | $2y$08$zz3rviw4qjfd5idtfzpw3orh0hxgo8brbxfoniqcvu33/ywqkuae
how import 3000 accounts passwords old system new system without having users register again?
also way encrypt passwords laravel 4 in same format help.
a workaround extends auth module in laravel, implement hash solution symfony.
rewriting auth::attempt()
, hashing password way want to, work.
same hash::x
, have rewrite function in auth
class hash new users password same way.
how can implement hash method :
create library in folder name libraries app, then, create serviceprovider :
libraries\symfonyhasherserviceprovider.php
use illuminate\support\serviceprovider; class symfonyhasherserviceprovider extends serviceprovider { public function register() { $this->app->bind('hash', function() { return new symfonyhasher; }); } }
then, create hasher, copy of symfony hash method :
libraries\symfonyhasher.php
class symfonyhasher implements illuminate\hashing\hasherinterface { public function make($value, array $options = array()) { /* make hash here */ } public function check($value, $hashedvalue, array $options = array()) { return $hashedvalue == $this->make($value); } }
replace 'illuminate\hashing\hashserviceprovider' 'symfonyhasherserviceprovider' in service providers array in app.php config, add 'app/libraries' autoload classmap in composer.json
i don't know how symfony make hashes, have search how symfony make hashes abd implement need do.
Comments
Post a Comment