H
H
hollanditkzn2018-02-01 09:46:08
Yii
hollanditkzn, 2018-02-01 09:46:08

Why can't I authorize a user?

I uploaded it to the hosting and authorization works fine there, but, on the local computer, for some reason, authorization began to fail today
Writes an error
exception 'yii\web\BadRequestHttpException' with message 'Failed to check the transmitted data.' in C:\OpenServer\domains\hostTraining\vendor\yiisoft\yii2\web\Controller.php:166
What could be the problem?
In SiteController

public function actionLogin()
    {
        if (!Yii::$app->user->isGuest) {
            return $this->redirect('index');
        }

        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            return $this->goBack();
        } else {
            return $this->render('login', [
                'model' => $model,
            ]);
        }
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Bukharev, 2018-02-01
@hollanditkzn

Are you generating the form using standard means?
are you passing the csrf token?

M
Maxim, 2018-02-01
@Mx21

Most likely a problem with the CSRF token.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question