<commit_before><?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 *
 * @package        symfony
 * @subpackage     plugin
 * @author         <NAME> <<EMAIL>>
 * @version        SVN: $Id$
 */
class sfGuardBasicSecurityFilter extends sfBasicSecurityFilter
{
    public function execute( $filterChain )
    {
        if ( $this->isFirstCall() )
        {
            if ( $cookie = $this->getContext()->getRequest()->getCookie( sfConfig::get( 'app_sf_guard_plugin_remember_cookie_name', 'sfRemember' ) ) )
            {
                $remember_key = sfDoctrine::queryFrom( 'sfGuardRememberKey' )->where( 'sfGuardRememberKey.remember_key = ?', $cookie )->execute()->getFirst();

                if ( $remember_key )
                {
                    $user = $remember_key->getUser();

                    if ( $user->exists() )
                    {
                        $this->getContext()->getUser()->signIn( $user );
                    }
                }
            }
        }

        parent::execute($filterChain);
    }
}<commit_msg>[wiki:sfGuardDoctrinePlugin]: Added extra logic to make sure remember me code is only executed if user is not authenticated.<commit_after><?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 *
 * @package        symfony
 * @subpackage     plugin
 * @author         <NAME> <<EMAIL>>
 * @version        SVN: $Id$
 */
class sfGuardBasicSecurityFilter extends sfBasicSecurityFilter
{
    public function execute( $filterChain )
    {
        if ( $this->isFirstCall() AND !$this->getContext()->getUser()->isAuthenticated() )
        {
            if ( $cookie = $this->getContext()->getRequest()->getCookie( sfConfig::get( 'app_sf_guard_plugin_remember_cookie_name', 'sfRemember' ) ) )
            {
                $remember_key = sfDoctrine::queryFrom( 'sfGuardRememberKey' )->where( 'sfGuardRememberKey.remember_key = ?', $cookie )->execute()->getFirst();

                if ( $remember_key )
                {
                    $user = $remember_key->getUser();

                    if ( $user->exists() )
                    {
                        $this->getContext()->getUser()->signIn( $user );
                    }
                }
            }
        }

        parent::execute($filterChain);
    }
}
{'fraction_non_alphanumeric': 0.1326452599388379, 'fraction_numerical': 0.0061162079510703364, 'mean_word_length': 1.9806378132118452, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4139527', 'n_tokens_mistral': 752, 'n_tokens_neox': 700, 'n_words': 167}