我会以非常直接的方式对用户进行身份验证(FOSUserBundle,Symfony2.2)。我正在尝试一个简单的例子,但它不起作用:
...
use FOS\UserBundle\Controller\RegistrationController as RegController;
...
class DefaultController extends Controller{
...
public function indexAction(){
$route = 'first_set_profile';
$url = $this->container->get('router')->generate($route);
$response = new RedirectResponse($url);
$userManager = $this->get('fos_user.user_manager');
$userToLogIn = $userManager->findUserByEmail('aa@bb.com');
new RegController(authenticateUser($userToLogIn, $response));
...
}
此脚本正在运行,但未使用电子邮件 aa@bb.com 对用户进行身份验证...
谢谢