I am resurrecting a website that has been down for a few years and I am migrating everything to Symfony2. I was able to get all of my old user database entries into the fos_user table. The only problem is that the salt and confirmation_token entries are empty because users were were not created the standard way. I want all users to reset their passwords, so I'm not worried about the old hashed passwords at all. How can I generate the entries for 13,000 users at once? Maybe I need to override the controller to create the salt and confirmation_token each time a password is requested? Do methods already exist for this? It seems like someone else would have had this problem before.
Thanks
I solved this by overriding the fosUserBundle Resetting controller. Instructions can be found here.
I forced generation of a new toke with these lines:
$tokenGenerator = $this->container->get('fos_user.util.token_generator');
$user->setConfirmationToken($tokenGenerator->generateToken());
I was able to generate the salt values with a simple SQL query.
UPDATE fos_user set salt = SUBSTRING(MD5(RAND()) FROM 1 FOR 31) WHERE salt IS NULL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With