I use symfony 2 with FOSuserbundle. Creat action for lock user with code:
$repository = $this->getDoctrine()->getRepository('MainUserBundle:User')
$user = $repository->findOneByUsername($request->request->get('name'));
/* some code */
$user->setLocked(true);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($user);
$em->flush();
But user get lock-in error message only if he logout and login again. How i can logout another user?
See my answer to a related question. Basically, you need to check for the lock flag in the equals method. This way, whenever the flag is changed, the user will have to reauthenticate.
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