L
L
Lander2015-11-02 16:49:47
Yii
Lander, 2015-11-02 16:49:47

How to define an authorization page for a module?

There is a basic application in Yii2. With its authorization action. I wrote a module for it, but the fact is that the module must have its own authorization with its own action and form. I dragged and filed the necessary functionality, but when I access the module controller, which is available only for an authorized user, it takes me to a page that is "site / login" for the entire application. How do I change the authorization action for a module?
I understand that the question is elementary and I'm very dumb, but I can't find something in the dock.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lander, 2015-11-03
@usdglander

Figured it out myself. Who cares - in the head file of the module in the init method:

public function init()
{
  \Yii::$app->user->loginUrl = \yii\helpers\Url::to(['/path/auth/login']);
        parent::init();
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question