Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

logout another user

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?

like image 763
Hello Avatar asked Nov 25 '25 02:11

Hello


1 Answers

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.

like image 117
Elnur Abdurrakhimov Avatar answered Nov 26 '25 19:11

Elnur Abdurrakhimov