How to override loginUrl for specific module

Hi,

I’m trying to override the loginUrl property in one of my modules but the setting is not being honoured. My web.php configuration file has the standard code:




//...

'user' => [

     'identityClass' => 'app\models\User',

     'enableAutoLogin' => true,

],

//....



While in my module class, in the init method, I’ve added




//....

$this->setComponents([

    'user' => [

        'loginUrl' => ['/pgespro/auth/index'],

        'class' => 'app\models\Utilizador',

        'enableAutoLogin' => true

    ]

]);

//....



I’m setting various other options in the module’s init method, and all are working except for the user component.

Also, don’t know if it is relevant, but I’m not following the advanced template but a modified version of the basic template where I’ve moved the vendor, the application and the web folders to be independent. Web folders sits as the document root for the domain, the other two are placed outside the webserver’s control.

Regards,

Sérgio Lopes

http://www.yiiframework.com/forum/index.php/topic/62350-solvedseperate-user-instance-in-module/page__view__findpost__p__276628

Thanks, I’ll try that approach and see how it works. Don’t know how it wasn’t one of the search results :unsure:

But if a module is supposed to be a “min” application wouldn’t it make sense to allow overriding the user component in the module’s init?

Regards,

Sérgio Lopes