Newscoop\GimmeBundle\Controller\OauthController::loginAction PHP Метод

loginAction() публичный Метод

Find out more informations about Newscoop REST API authentiocation here: [click me][1] [1]: http://docs.sourcefabric.org/projects/newscoop-restful-api/en/master/tutorial.html
public loginAction ( Request $request )
$request Symfony\Component\HttpFoundation\Request
    public function loginAction(Request $request)
    {
        $session = $request->getSession();
        $templatesService = $this->get('newscoop.templates.service');
        if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
            $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
        } elseif (null !== $session && $session->has(SecurityContext::AUTHENTICATION_ERROR)) {
            $error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
            $session->remove(SecurityContext::AUTHENTICATION_ERROR);
        } else {
            $error = false;
        }
        if ($error) {
            $error = $error->getMessage();
        }
        $lastUsername = null === $session ? '' : $session->get(SecurityContext::LAST_USERNAME);
        $smarty = $templatesService->getSmarty();
        $smarty->assign('lastUsername', $lastUsername);
        $smarty->assign('error', $error);
        $smarty->assign('targetPath', $request->getSession()->get('_security.oauth_authorize.target_path'));
        return new Response($templatesService->fetchTemplate('oauth_login.tpl'), 200, array('Content-Type' => 'text/html'));
    }