ajax - Auto connect user with fos user bundle / symfony 2 -
i auto connect user after subscription (my subscription method in ajax).
i have :
// creation of $user + setters of $user $usermanager = $this->get('fos_user.user_manager'); $usermanager->updateuser($user, true, true, true); $em->persist($user); $em->flush(); // connection of user here
edit :
i want in php of course , not in js new ajax request.
edit 2 :
i maybe find something. trying :
$this->authenticateuser($user);
thanks
use symfony\component\security\core\authentication\token\usernamepasswordtoken; $token = new usernamepasswordtoken($user, $user->getpassword(), 'main', $user->getroles()); $context = $this->get('security.context'); $context->settoken($token);
Comments
Post a Comment