redirect page after login

Hello All,

I have used user module and when I am going to login, after login it is redirected to the profile page as user module is used there.I want that after login the page should be redirect to index page, So I used inside config -> main.php file


    'components'=>array(

            'user'=>array(

                    // enable cookie-based authentication

                    'allowAutoLogin'=>true,

                    #users module starts here

                    'loginUrl' => array('/user/login'),

                    'returnUrl' => array('/site/index'),

                    #users module ends here

            ),

  ),



But it did not worked. After that I saw that inside user module there is already defined returnUrl like


public $returnUrl = array("/user/profile"); 

As returnUrl is defined like this inside user module how should I redirect index page without any changes inside user module.How to override that?

In this case you should specify returnUrl in module config:




'modules'=>array(

    'user'=>array(

        'returnUrl'=>array('/site/index'),

    ),

),



No,

need add parameter in config




array(

    ......

    'components'=>array(

        'user'=>array(

            // this is actually the default value

            'loginUrl'=>array('site/login'),

        ),

    ),

)



What he said. ;)

What if i don’t want to redirect to a static page, but rather return to the page i tried to access or was sent away from due to a session timeout?