1

Code which i am using is given below

public function loginUser($email, $password){
   $session = Mage::getSingleton('customer/session');

    try {
        $log = $session->login($email, $password);
        return $log;
     } 

    catch (Exception $ex) {
        return false;
    }
 }

it returns 1 but not log in the browser , when i refresh the page it is not going set as a login user

0

1 Answer 1

5

I think you need an additional call to Mage_Customer_Model_Session::setCustomerAsLoggedIn()

public function loginUser( $email, $password )
{
    /** @var $session Mage_Customer_Model_Session */
    $session = Mage::getSingleton( 'customer/session' );

    try
    {
        $session->login( $email, $password );
        $session->setCustomerAsLoggedIn( $session->getCustomer() );
        return true;
    }
    catch( Exception $e )
    {
        return false;
    }
}
Sign up to request clarification or add additional context in comments.

4 Comments

@Amit Maurya Was that a question?
this code is also work as above it return true but not login in to the browser
actually i want to login through designer tool software with php code
Well, it works from my TYPO3 plugin and connects both application logins…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.