Why can't I authenticate the user?

I unloaded on hosting and there everything works fine logging in, but here in the local computer, why is today beginning to fail authorization
Writes an error
exception 'yii\web\BadRequestHttpException' with message 'unable to validate the transmitted data.' in C:\OpenServer\domains\hostTraining\vendor\yiisoft\yii2\web\Controller.php:166
What could be the problem?
In controller 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,
]);
}
 }
June 8th 19 at 17:06
2 answers
June 8th 19 at 17:08
Solution
The standard form by standard means generate?
pass the csrf token?
But it's a normal authorization on yii2 I didn't change it basically - Waylon_Kub commented on June 8th 19 at 17:11
Here is my post request

_csrf-frontend: 'gH7F5ZTNl3RA7ew71wxf5K0LxgmlFm8iek9dz7nvgmjsdvce8kamws-bunqGWi6Kx0aveJxeFmlj6D789YTNmg=='
LoginForm: [
 'username' => 'admin'
 'password' => 'kazan1811'
 'rememberMe' => '1'
]
login-button: "
- Waylon_Kub commented on June 8th 19 at 17:14
I have tried now to add one file I have some problem with config/main-local.php There what could be wrong? to the database correctly connected I? - Waylon_Kub commented on June 8th 19 at 17:17
So it is difficult to say 400 error above you, 100% because of the crsf token, you don't perdete to the server, create a form using ActiveForm and standard check in form will necessarily hidden field with the token.
Also check the name of the attribute which will accept a token, defaults to _csrf, you have the example _csrf-frontend, apparently changed the setting request, try to disable the changes. You may pass the token, the application can not disassemble it, examine the line 166 in yiisoft\yii2\web\Controller.php there you will understand what to expect from you app and what do you really convey her - adell17 commented on June 8th 19 at 17:20
June 8th 19 at 17:10
Most likely a problem with the CSRF token.
I tried to turn it off
public function beforeAction($action)
{
 $this->enableCsrfValidation = false;

 return parent :: beforeAction($action);
 }

But now the question is that I have a blank page appears. I do not understand why this all came - Waylon_Kub commented on June 8th 19 at 17:13
And do not understand why on the server everything works fine, but LAN not working - Waylon_Kub commented on June 8th 19 at 17:16
the error output is included? Just in case index.php
ini_set('display_errors','On');
 error_reporting(E_ALL);
- Waylon_Kub commented on June 8th 19 at 17:19
Included, but still I do not understand what this error is and why on the server it works but on LAN no - adell17 commented on June 8th 19 at 17:22
In the server logs what kind of information? - Waylon_Kub commented on June 8th 19 at 17:25
On the server sure to watch or on the LAN? just on the server everything works fine - Waylon_Kub commented on June 8th 19 at 17:28
Can you give a link to github
Or here is the log local
2018-02-01 10:44:20 [127.0.0.1][-][hub859ojd1ji59um0tan4m8uo3][error][yii\web\HttpException:400] exception 'yii\web\BadRequestHttpException' with message 'unable to validate the transmitted data.' in C:\OpenServer\domains\hostTraining\vendor\yiisoft\yii2\web\Controller.php:166
Stack trace:
#0 C:\OpenServer\domains\hostTraining\vendor\yiisoft\yii2\base\Controller.php(155): yii\web\Controller->beforeAction(Object(yii\base\InlineAction))
#1 C:\OpenServer\domains\hostTraining\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('login', Array)
#2 C:\OpenServer\domains\hostTraining\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('site/login', Array)
#3 C:\OpenServer\domains\hostTraining\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))
#4 C:\OpenServer\domains\hostTraining\frontend\web\index.php(17): yii\base\Application->run()
#5 {main}
2018-02-01 10:44:20 [127.0.0.1][-][hub859ojd1ji59um0tan4m8uo3][info][application] $_GET = [
 'r' => 'site/login'
]

$_POST = [
 '_csrf-frontend' => '2051Ga11rLAjJ8O3fejKENLDPEpQCvD13ekhm8xvq7yhbr525gwb20seqo1eviluufslejm4wpczhop3_gmeyg=='
 'LoginForm' => [
 'username' => 'admin'
 'password' => 'kazan1811'
]
 'login-button' => "
]

$_SESSION = [
 '__flash' => []
]

$_SERVER = [
 'HTTP_HOST' => 'hosttraining'
 'HTTP_CONNECTION' => 'keep-alive'
 'CONTENT_LENGTH' => '185'
 'HTTP_CACHE_CONTROL' => 'max-age=0'
 'HTTP_ORIGIN' => 'http://hosttraining'
 'HTTP_UPGRADE_INSECURE_REQUESTS' => '1'
 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 YaBrowser/17.11.1.988 Yowser/2.5 Safari/537.36'
 'CONTENT_TYPE' => 'application/x-www-form-urlencoded'
 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8'
 'HTTP_REFERER' => 'http://hosttraining/frontend/web/index.php?r=site%2Flogin'
 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate'
 'HTTP_ACCEPT_LANGUAGE' => 'ru,EN;q=0.9'
 'PATH' = > 'c:\\openserver\\modules\\php\\PHP-5.6-x64\\ext;c:\\openserver\\modules\\php\\PHP-5.6-x64\\pear;c:\\openserver\\modules\\php\\PHP-5.6-x64\\pear\\bin;c:\\openserver\\modules\\php\\PHP-5.6-x64;c:\\openserver\\modules\\imagemagick;c:\\openserver\\modules\\wget\\bin;c:\\openserver\\modules\\git;c:\\openserver\\modules\\git\\bin;c:\\openserver\\modules\\git\\mingw\\bin;c:\\openserver\\modules\\git\\cmd;c:\\openserver\\modules\\database\\MySQL-5.5-x64\\bin;c:\\openserver\\modules\\database\\MongoDB-3.2-x64;c:\\openserver\\modules\\http\\Apache-2.4-x64\\bin;c:\\openserver\\modules\\http\\Apache-2.4-x64;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\system32\\Wbem;C:\\Windows\\SysWOW64;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\ProgramData\\ComposerSetup\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files (x86)\\Brackets\\command;C:\\Program Files (x86)\\Skype\\Phone\\;C:\\Users\\Rus\\AppData\\Roaming\\nvm;C:\\Program Files\nodejs;C:\\Program Files\\nodejs\\;C:\\OpenServer\\modules\\php\\PHP-5.6-x64;C:\\Program Files\\PuTTY;C:\\Ruby24-x64\\bin;C:\\Users\\Rus\\AppData\\Roaming\\Composer\\vendor\\bin;C:\\Users\\Rus\\AppData\\Roaming\\npm;C:\\Users\\Rus\\AppData\\Local\\GitHubDesktop\\bin;C:\\Users\\Rus\\AppData\\Roaming\\nvm;C:\\Program Files\nodejs'
 'SystemRoot' => 'C:\\Windows'
 'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
 'WINDIR' => 'C:\\Windows'
 'SERVER_SIGNATURE' => "
 'SERVER_SOFTWARE' => 'Apache'
 'SERVER_NAME' => 'hosttraining'
 'SERVER_ADDR' => '127.0.0.1'
 'SERVER_PORT' => '80'
 'REMOTE_ADDR' => '127.0.0.1'
 'DOCUMENT_ROOT' => 'C:/OpenServer/domains/hostTraining'
 'REQUEST_SCHEME' => 'http'
 'CONTEXT_PREFIX' => "
 'CONTEXT_DOCUMENT_ROOT' => 'C:/OpenServer/domains/hostTraining'
 'SERVER_ADMIN' => '[no address given]'
 'SCRIPT_FILENAME' => 'C:/OpenServer/domains/hostTraining/frontend/web/index.php'
 'REMOTE_PORT' => '10422'
 'GATEWAY_INTERFACE' => 'CGI/1.1'
 'SERVER_PROTOCOL' => 'HTTP/1.1'
 'REQUEST_METHOD' => 'POST'
 'QUERY_STRING' => 'r=site%2Flogin'
 'REQUEST_URI' => '/frontend/web/index.php?r=site%2Flogin'
 'SCRIPT_NAME' => '/frontend/web/index.php'
 'PHP_SELF' => '/frontend/web/index.php'
 'REQUEST_TIME_FLOAT' => 1517471060.713
 'REQUEST_TIME' => 1517471060
 'argv' => [
 0 => 'r=site%2Flogin'
]
 'argc' => 1
]
- dan_Stroman53 commented on June 8th 19 at 17:31
,
If you look at the controller we see the cause, but it is not a good check csrf token
if ($this->enableCsrfValidation && Yii::$app->getErrorHandler()->exception === null && !Yii::$app->getRequest()->validateCsrfToken()) {
 throw new BadRequestHttpException(Yii::t('yii', 'Unable to verify your data submission.'));
 }
- Waylon_Kub commented on June 8th 19 at 17:34

Find more questions by tags Yii