{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/8991","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/8991/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/8991/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/8991/events","html_url":"https://github.com/yiisoft/yii2/issues/8991","id":92820320,"number":8991,"title":"I'm always authorized in Yii2","user":{"login":"bohdan-vorona","id":5950639,"avatar_url":"https://avatars.githubusercontent.com/u/5950639?v=3","gravatar_id":"","url":"https://api.github.com/users/bohdan-vorona","html_url":"https://github.com/bohdan-vorona","followers_url":"https://api.github.com/users/bohdan-vorona/followers","following_url":"https://api.github.com/users/bohdan-vorona/following{/other_user}","gists_url":"https://api.github.com/users/bohdan-vorona/gists{/gist_id}","starred_url":"https://api.github.com/users/bohdan-vorona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bohdan-vorona/subscriptions","organizations_url":"https://api.github.com/users/bohdan-vorona/orgs","repos_url":"https://api.github.com/users/bohdan-vorona/repos","events_url":"https://api.github.com/users/bohdan-vorona/events{/privacy}","received_events_url":"https://api.github.com/users/bohdan-vorona/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/status:need%20more%20info","name":"status:need more info","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-07-03T08:21:06Z","updated_at":"2015-07-07T20:07:17Z","closed_at":null,"body":"**View:**\r\n\r\n    <?php\r\n    \t$modelLogin = new \\app\\models\\LoginForm();\r\n    ?>\r\n    <div class=\"auth_box\">\r\n    \t<?php $form = ActiveForm::begin([\r\n    \t\t'id' => 'login-form',\r\n    \t\t'action' => ['site/login'],\r\n    \t\t'enableClientValidation' => false,\r\n    \t\t'enableAjaxValidation' => true,\r\n    \t\t//'options' => ['class' => 'form-horizontal'],\r\n    \t\t'fieldConfig' => [\r\n    \t\t\t'template' => \"{input}\\n<div class=\\\"form_error\\\">{error}</div>\"\r\n    \t\t]\r\n    \t]); ?>\r\n    \r\n    \t<?= $form->field($modelLogin, 'username')->textInput(['placeholder' => 'Login']) ?>\r\n    \r\n    \t<?= $form->field($modelLogin, 'password')->passwordInput(['placeholder' => 'Password']) ?>\r\n    \r\n    \t<?= $form->field($modelLogin, 'rememberMe', [\r\n    \t\t'template' => \"{input}\",\r\n    \t])->checkbox() ?>\r\n    \r\n    \t<?= Html::submitInput('Enter') ?>\r\n    \r\n    \t<?php ActiveForm::end(); ?>\r\n    </div>\r\n\r\n**Controller:**\r\n\r\n    public function actionLogin()\r\n    {\r\n        if (!\\Yii::$app->user->isGuest) {\r\n            return $this->goHome();\r\n        }\r\n    \r\n        $modelLogin = new LoginForm();\r\n    \r\n        if (Yii::$app->request->isAjax) {\r\n    \t    $modelLogin->load(Yii::$app->request->post());\r\n    \t    Yii::$app->response->format = Response::FORMAT_JSON;\r\n    \t    return ActiveForm::validate($modelLogin);\r\n        } elseif ($modelLogin->load(Yii::$app->request->post()) && $modelLogin->login()) {\r\n    \t    return $this->goBack();\r\n        }\r\n    }\r\n\r\n**Model, method login:**\r\n\r\n    public function login()\r\n    {\r\n    \tif ($this->validate()) {\r\n    \t\treturn Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 365 : 0);\r\n    \t} else {\r\n    \t\treturn false;\r\n    \t}\r\n    }\r\n\r\nWhen I check \"remember me\" my cookies looks like:\r\n\r\n![enter image description here][1]\r\n\r\nThere is **_identity** parameter.\r\n\r\n\r\nWhen I don't check \"remember me\" my cookies looks like:\r\n\r\n![enter image description here][2]\r\n\r\nThere is not **_identity** parameter.\r\n\r\n\r\n  [1]: http://i.stack.imgur.com/6bhmj.png\r\n  [2]: http://i.stack.imgur.com/uqyYs.png\r\n\r\n**In both cases I'm always authorized after reopening my browser.**"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/119320298","html_url":"https://github.com/yiisoft/yii2/issues/8991#issuecomment-119320298","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/8991","id":119320298,"user":{"login":"samdark","id":47294,"avatar_url":"https://avatars.githubusercontent.com/u/47294?v=3","gravatar_id":"","url":"https://api.github.com/users/samdark","html_url":"https://github.com/samdark","followers_url":"https://api.github.com/users/samdark/followers","following_url":"https://api.github.com/users/samdark/following{/other_user}","gists_url":"https://api.github.com/users/samdark/gists{/gist_id}","starred_url":"https://api.github.com/users/samdark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdark/subscriptions","organizations_url":"https://api.github.com/users/samdark/orgs","repos_url":"https://api.github.com/users/samdark/repos","events_url":"https://api.github.com/users/samdark/events{/privacy}","received_events_url":"https://api.github.com/users/samdark/received_events","type":"User","site_admin":false},"created_at":"2015-07-07T20:07:17Z","updated_at":"2015-07-07T20:07:17Z","body":"Wait, it your first message you said that when remember me isn't checked you have session cookie only..."}}