A
A
Alexander Sinitsyn2016-08-22 12:27:04
Yii
Alexander Sinitsyn, 2016-08-22 12:27:04

How to make a login form on the main page?

Do I need to make a widget with Pjax or is it possible somehow easier?
Transferred the form from login.php, but on error it goes to /login

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2016-08-22
@a_u_sinitsin

It is not entirely clear what Pjax has to do with it and what exactly is the problem. If you have a problem redirecting to /login, then you just need to change the loginUrl parameter in the User component, like this:

'components' => [
    'user' => [
        'identityClass' => <тут Ваш класс пользователей>
        'loginUrl' => [
            '/new-login-page' // тут ссылка на страницу авторизации
        ],
    ],
]

N
Nikita, 2016-08-22
@bitver

Make your POST request if it doesn't. Next, in the login action, return this:

return $this->redirect(Yii::$app->request->referer);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question