{"id":5042,"date":"2021-08-09T09:40:55","date_gmt":"2021-08-09T09:40:55","guid":{"rendered":"https:\/\/www.bearloga.space\/?page_id=5042"},"modified":"2021-08-09T09:40:56","modified_gmt":"2021-08-09T09:40:56","slug":"yii-avtorizacziya","status":"publish","type":"page","link":"https:\/\/www.bearloga.space\/uk\/yii-avtorizacziya\/","title":{"rendered":"Yii \u2014 \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0430\u0432 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0447\u0435\u0433\u043e-\u043b\u0438\u0431\u043e, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f&nbsp;<strong>\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439<\/strong>&nbsp;.&nbsp;Yii \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 ACF (\u0444\u0438\u043b\u044c\u0442\u0440 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430), \u043c\u0435\u0442\u043e\u0434 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u043a&nbsp;<strong>yii \\ filters \\ AccessControl<\/strong>&nbsp;.&nbsp;\u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 () \u0444\u0443\u043d\u043a\u0446\u0438\u0438 SiteController \u2014<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">public function behaviors() {\n   return [\n      'access' =&gt; [\n         'class' =&gt; AccessControl::className(),\n         'only' =&gt; ['about', 'contact'],\n         'rules' =&gt; [\n            [\n               'allow' =&gt; true,\n               'actions' =&gt; ['about'],\n               'roles' =&gt; ['?'],\n            ],\n            [\n               'allow' =&gt; true,\n               'actions' =&gt; ['contact', 'about'],\n               'roles' =&gt; ['@'],\n            ],\n         ],\n      ],\n   ];\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u043a\u043e\u0434\u0435 ACF \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.&nbsp;\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e ACF \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c about \u0438 contact.&nbsp;\u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0435 \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u0430.&nbsp;\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u043e rules \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u0430.&nbsp;\u0412\u0441\u0435 \u0433\u043e\u0441\u0442\u0438 (\u0441 \u0440\u043e\u043b\u044c\u044e \u00ab?\u00bb) \u0421\u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0430\u043a\u0446\u0438\u0438.&nbsp;\u0412\u0441\u0435\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c (\u0441 \u0440\u043e\u043b\u044c\u044e \u00ab@\u00bb) \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0443 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442\u0435 \u043f\u043e URL-\u0430\u0434\u0440\u0435\u0441\u0443&nbsp;<strong>http: \/\/ localhost: 8080 \/ index.php? R = site \/ about<\/strong>&nbsp;, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u043d\u043e \u0435\u0441\u043b\u0438 \u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0435 URL-\u0430\u0434\u0440\u0435\u0441&nbsp;<strong>http: \/\/ localhost: 8080 \/ index.php? R = \u0441\u0430\u0439\u0442 \/ \u043a\u043e\u043d\u0442\u0430\u043a\u0442<\/strong>&nbsp;, \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432\u0445\u043e\u0434\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e&nbsp;<strong>\u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0446\u0438\u0439 \u2014<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>allow<\/strong>&nbsp;\u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e\u043c \u00ab\u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c\u00bb \u0438\u043b\u0438 \u00ab\u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c\u00bb.<\/li><li><strong>\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/strong>&nbsp;\u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0438\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.<\/li><li><strong>\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b<\/strong>&nbsp;\u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.<\/li><li><strong>role<\/strong>&nbsp;\u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u043e\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.&nbsp;\u0414\u0432\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u043e\u043b\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u044e\u0442\u0441\u044f \u2014<ul><li><strong>?<\/strong>&nbsp;\u2014 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u043e\u0441\u0442\u0435\u0432\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/li><li><strong>@<\/strong>&nbsp;\u2014 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/li><\/ul><\/li><li><strong>ips<\/strong>&nbsp;\u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 IP-\u0430\u0434\u0440\u0435\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.<\/li><li><strong>\u0413\u043b\u0430\u0433\u043e\u043b\u044b<\/strong>&nbsp;\u2014 \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (POST, GET, PUT \u0438 \u0442. \u0434.) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443.<\/li><li><strong>matchCallback<\/strong>&nbsp;\u2014 \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e PHP, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.<\/li><li><strong>denyCallback<\/strong>&nbsp;\u2014 \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e PHP, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e&nbsp;<strong>\u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442<\/strong>&nbsp;\u0434\u043e\u0441\u0442\u0443\u043f.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>allow<\/strong>&nbsp;\u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e\u043c \u00ab\u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c\u00bb \u0438\u043b\u0438 \u00ab\u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c\u00bb.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/strong>&nbsp;\u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0438\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b<\/strong>\u00a0\u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>role<\/strong>&nbsp;\u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u043e\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.&nbsp;\u0414\u0432\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u043e\u043b\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u044e\u0442\u0441\u044f \u2014<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>?<\/strong>&nbsp;\u2014 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0433\u043e\u0441\u0442\u0435\u0432\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>@<\/strong>&nbsp;\u2014 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>ips<\/strong>&nbsp;\u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 IP-\u0430\u0434\u0440\u0435\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0413\u043b\u0430\u0433\u043e\u043b\u044b<\/strong>&nbsp;\u2014 \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (POST, GET, PUT \u0438 \u0442. \u0434.) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>matchCallback<\/strong>&nbsp;\u2014 \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e PHP, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>denyCallback<\/strong>&nbsp;\u2014 \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e PHP, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e&nbsp;<strong>\u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442<\/strong>&nbsp;\u0434\u043e\u0441\u0442\u0443\u043f.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u041f\u0430\u0440\u043e\u043b\u0438<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 1<\/strong>&nbsp;\u2014 Yii \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u0430\u0440\u043e\u043b\u044f\u043c\u0438.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">public function actionAuth() {\n\n   $password = \"asd%#G3\";\n   \n   \/\/generates password hasg\n   $hash = Yii::$app-&gt;getSecurity()-&gt;generatePasswordHash($password);\n   var_dump($hash);\n   \n   \/\/validates password hash\n   if (Yii::$app-&gt;getSecurity()-&gt;validatePassword($password, $hash)) {\n      echo \"correct password\";\n   } else {\n      echo \"incorrect password\";\n   }\n   \n   \/\/generate a token\n   $key = Yii::$app-&gt;getSecurity()-&gt;generateRandomString();\n   var_dump($key);\n   \n   \/\/encrypt data with a secret key\n   $encryptedData = Yii::$app-&gt;getSecurity()-&gt;encryptByPassword(\"mydata\", $key);\n   var_dump($encryptedData);\n   \n   \/\/decrypt data with a secret key\n   $data = Yii::$app-&gt;getSecurity()-&gt;decryptByPassword($encryptedData, $key);\n   var_dump($data);\n   \n   \/\/hash data with a secret key\n   $data = Yii::$app-&gt;getSecurity()-&gt;hashData(\"mygenuinedata\", $key);\n   var_dump($data);\n   \n   \/\/validate data with a secret key\n   $data = Yii::$app-&gt;getSecurity()-&gt;validateData($data, $key);\n   var_dump($data);\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 2<\/strong>&nbsp;\u2014 \u0412\u0432\u0435\u0434\u0438\u0442\u0435 URL&nbsp;<strong>http: \/\/ localhost: 8080 \/ index.php? R = site \/ auth<\/strong>&nbsp;, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0430\u0432 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0447\u0435\u0433\u043e-\u043b\u0438\u0431\u043e, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f&nbsp;\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439&nbsp;.&nbsp;Yii \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 ACF (\u0444\u0438\u043b\u044c\u0442\u0440 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430), \u043c\u0435\u0442\u043e\u0434 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[156],"tags":[],"class_list":["post-5042","page","type-page","status-publish","hentry","category-yii"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/5042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/comments?post=5042"}],"version-history":[{"count":1,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/5042\/revisions"}],"predecessor-version":[{"id":5043,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/5042\/revisions\/5043"}],"wp:attachment":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/media?parent=5042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/categories?post=5042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/tags?post=5042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}