sonata-project / SonataUserBundle

Symfony SonataUserBundle
https://docs.sonata-project.org/projects/SonataUserBundle
MIT License
342 stars 487 forks source link

Password do not work in admin form login after upgrade to 5.x-dev #1483

Closed grthi closed 2 years ago

grthi commented 2 years ago

Hello, Im upgrading from sonata user bundle from version "4.5.3" to this new "5.x-dev"

I have replace this part in security.yaml

providers:
    fos_userbundle:
        id: fos_user.user_provider.username_email

firewalls:
    admin:
        form_login:
            provider:       fos_userbundle

encoders:
    FOS\UserBundle\Model\UserInterface: bcrypt

With this new code

providers:
    sonata_user_bundle:
        id: sonata.user.security.user_provider

firewalls:
    admin:
        form_login:
            provider:       sonata_user_bundle

encoders:
    Sonata\UserBundle\Model\UserInterface: bcrypt

So I must have continue to use same "bcrypt" encoding like before. But I have password not working anymore to login in BO with existing admin accounts,

Have we a command to reinit them? Or what is the process?

I do not find information about this, perhaps I have miss something?

Thanks for help.

jordisala1991 commented 2 years ago

This is how it worked with FOSUser: https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Util/PasswordUpdater.php

Can you check with https://github.com/sonata-project/SonataUserBundle/pull/1484 to see if you can create an admin (with the roles needed) via CLI commands and if you are able to log in with it.

This way we can be sure this is a problem with how was the password generated with FOSUser or something general for the 5.x branch.

Also keep in mind the 5.x branch is unstable and not ready for production usage.

grthi commented 2 years ago

So finally I have use the bo interface for forgot password to can be able to login in BO.

But thanks, for the #1484, it must do what I need.

I close this so.

jordisala1991 commented 2 years ago

Do not close please, I would like to take a look at why the password set previously with FOSUser does not work with the new version.

Do you know what changes in the database between a non working password and a working one? (same password)

jordisala1991 commented 2 years ago

Closing for now, since I can't reproduce on fresh upgrades form SonataUserBundle 4 to 5.

See: https://github.com/sonata-project/SonataUserBundle/issues/1465#issuecomment-1048540171