1
我會以非常直接的方式驗證用戶(FOSUserBundle,Symfony2.2)。我'用一個簡單的例子很努力,但它不工作:FOSUserBundle驗證所選用戶
...
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('[email protected]');
new RegController(authenticateUser($userToLogIn, $response));
...
}
此腳本運行,但不進行身份驗證與電子郵件[email protected] ...
感謝用戶
謝謝帕齊, 它的工作就像一個魅力! – karpatil