Search code examples
symfonysymfony4password-encryption

Symfony 4 - password saved in argon2i instead of bcrypt only on prod server


In my yaml security config file :

security:
    encoders:
        App\Entity\Tenant\User:
          algorithm: 'bcrypt'

In my user controller to modify password for user edit page :

$user->setPassword($passwordEncoder->encodePassword($user,$plain_password));

On my developpement server in prod and dev environnement everythings work.But on my prod server symfony convert password in argon2i instead of bcrypt. I dont know why....So in my database for exemple stocked hashed password is "$argon2i$v=19$m=65536,t=4,p=1$aFRHTC5sQTZESXpOOVlFTA$NZvz/a0EkjL00cf9ZbYzuhiT+nMq13Dvr2Xp/lU78Lc" instead of bcrypt.

Someone would have any idea why UserPasswordEncoderInterface force argon2I only on my prod server instead of bcrypt which is set in the yaml security file?

Dev server : PHP 7.3.12.

Prod server : PHP 7.3.19

Symfony 4.4.5

Edit : After some other tests, password is correctly encoded in bcrypt on prod server in dev environnement. Problem appear only in prod environement...


Solution

  • Problem solved

    It was a cache problem, my first reflex was to use commande line 'cache:clear --env=prod', but that not solved my problem. To be sure i deleted manually the prod cache folder. And this solved the problem, password are now correctly encoded in bcrypt.