E
E
e-hot2015-10-20 10:47:12
symfony
e-hot, 2015-10-20 10:47:12

Authorization in Symfony2 - User account is disabled. How to fix?

Welcome all. I need help - I can't deal with the following situation:
1. Moved the project from the local machine from env=dev ( app_dev.php ) to VDS hosting ( nginx+php5-fpm+mariadb+phpmyadmin+Symfony2 ) from env=prod ( app. php).
2. Connection with a DB functions - this moment tested.
3. Authorization: the standard functionality of Symfony is used (I did not use third-party libraries), bcrypt 12 encryption, the provider - users from the database.
4. Problem: when authorizing, it gives out "User account is disabled" - in fact, I studied solutions on the Internet - nothing helps, in the DB.User the value is_active = 1 initially, there were no such problems on the local version of the project.
5. Question: tell me where else to look, perhaps the described problem arose due to the change of environment from dev to prod. Thank you in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jaxel, 2015-10-20
@e-hot

Your user class must implement Symfony\Component\Security\Core\User\AdvancedUserInterface in order to work with the standard security component.
According to this interface, there must be an isEnabled() method that returns true. Otherwise, this error occurs.

E
e-hot, 2015-10-20
@e-hot

Thanks a lot for the tip!!! I looked at the User entity - everything is written in it as in the documentation - the User class is implemented from AdvancedUserInterface, there is an isEnabled() method - in theory everything should work.
I looked in the database at the User table, because confused in the User class description:

/**
* @ORM\Column(name="is_active", type="integer")
*/
private $isActive;

in the User table for is_active data type bit, changed to boolean and in the User class in:
/**
* @ORM\Column(name="is_active", type="boolean")
*/
private $isActive;

- everything worked! That's what inattention means... But it's strange why then I didn't have such a situation on the local version of the project...
Thank you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question