{"id":628,"date":"2022-02-09T23:01:56","date_gmt":"2022-02-09T20:01:56","guid":{"rendered":"http:\/\/atonko.ru\/?p=628"},"modified":"2022-03-18T17:53:44","modified_gmt":"2022-03-18T14:53:44","slug":"%d1%81%d0%b0%d0%b9%d1%82-%d0%bd%d0%b0-golang-%d0%b0%d0%b2%d1%82%d0%be%d1%80%d0%b8%d0%b7%d0%b0%d1%86%d0%b8%d1%8f-%d1%87%d0%b0%d1%81%d1%82%d1%8c-4","status":"publish","type":"post","link":"https:\/\/alextonkonogov.ru\/?p=628","title":{"rendered":"\u0421\u0430\u0439\u0442 \u043d\u0430 Golang. \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f. \u0427\u0430\u0441\u0442\u044c 4"},"content":{"rendered":"\n<p>\u0417\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u0444\u043e\u0440\u043c\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438; <\/li><li>\u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u0434\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0444\u043e\u0440\u043c\u044b \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043b\u043e\u0433\u0438\u043a\u0438;<\/li><li>\u043c\u0435\u0442\u043e\u0434, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0431\u0430\u0437\u0443.<\/li><\/ul>\n\n\n\n<p>\u041d\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441 \u043a\u043e\u043d\u0446\u0430 &#8211; \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 user.go \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go\">func (r *Repository) AddNewUser(ctx context.Context, name, surname, login, hashedPassword string) (err error) {\n\t_, err = r.pool.Exec(ctx, `insert into users (name, surname, login, hashed_password) values ($1, $2,$3, $4)`, name, surname, login, hashedPassword)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to exec data: %w\", err)\n\t\treturn\n\t}\n\treturn\n}<\/code><\/pre>\n\n\n\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u0432\u0445\u043e\u0434 \u0438\u043c\u044f, \u0444\u0430\u043c\u0438\u043b\u0438\u044e, \u043b\u043e\u0433\u0438\u043d \u0438 \u0445\u0435\u0448 \u043f\u0430\u0440\u043e\u043b\u044f \u0438 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0415\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441 \u0442\u0430\u043a\u0438\u043c \u043b\u043e\u0433\u0438\u043d\u043e\u043c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442), \u0442\u043e \u043c\u044b \u0432\u0435\u0440\u043d\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443 (\u043a\u0441\u0442\u0430\u0442\u0438, \u0437\u0430 \u044d\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0441\u0430\u043c\u0430 \u0411\u0414: \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u0442\u043e \u0434\u043b\u044f login \u043c\u044b \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a unique).<\/p>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430\u0441 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0434\u0435\u043c \u0432 application.go \u0438 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Routes \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go\">\tr.GET(\"\/signup\", func(rw http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t\ta.SignupPage(rw, \"\")\n\t})<\/code><\/pre>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c Routes \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go\">func (a app) Routes(r *httprouter.Router) {\n\tr.ServeFiles(\"\/public\/*filepath\", http.Dir(\"public\"))\n\tr.GET(\"\/\", a.authorized(a.StartPage))\n\tr.GET(\"\/login\", func(rw http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t\ta.LoginPage(rw, \"\")\n\t})\n\tr.POST(\"\/login\", a.Login)\n\tr.GET(\"\/logout\", a.Logout)\n\tr.GET(\"\/signup\", func(rw http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t\ta.SignupPage(rw, \"\")\n\t})\n}<\/code><\/pre>\n\n\n\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go\">func (a app) SignupPage(rw http.ResponseWriter, message string) {\n\tsp := filepath.Join(\"public\", \"html\", \"signup.html\")\n\ttmpl, err := template.ParseFiles(sp)\n\tif err != nil {\n\t\thttp.Error(rw, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\ttype answer struct {\n\t\tMessage string\n\t}\n\tdata := answer{message}\n\terr = tmpl.ExecuteTemplate(rw, \"signup\", data)\n\tif err != nil {\n\t\thttp.Error(rw, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n}<\/code><\/pre>\n\n\n\n<p>\u0418 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e html \u0448\u0430\u0431\u043b\u043e\u043d (public\/html\/signup.html):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"markup\" class=\"language-markup\">{{define \"signup\"}}\n&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n&lt;head>\n    &lt;meta charset=\"UTF-8\">\n    &lt;title>Sign up page&lt;\/title>\n&lt;\/head>\n&lt;body>\n&lt;form id=\"loginForm\" name=\"signUpForm\" action=\"\/signup\" method=\"post\" >\n    &lt;label for=\"name\">\u0418\u043c\u044f&lt;\/label>&lt;br>\n    &lt;input type=\"text\" id=\"name\" name=\"name\" required>&lt;br>\n    &lt;label for=\"surname\">\u0424\u0430\u043c\u0438\u043b\u0438\u044f&lt;\/label>&lt;br>\n    &lt;input type=\"text\" id=\"surname\" name=\"surname\" required>&lt;br>\n    &lt;label for=\"login\">\u041b\u043e\u0433\u0438\u043d&lt;\/label>&lt;br>\n    &lt;input type=\"login\" id=\"login\" name=\"login\" required>&lt;br>\n    &lt;label for=\"password\">\u041f\u0430\u0440\u043e\u043b\u044c&lt;\/label>&lt;br>\n    &lt;input type=\"password\" id=\"password\" name=\"password\" required>&lt;br>\n    &lt;label for=\"password2\">\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044c&lt;\/label>&lt;br>\n    &lt;input type=\"password\" id=\"password2\" name=\"password2\" required>&lt;br>\n    &lt;br>\n    &lt;button type=\"submit\" name=\"submitBtn\">\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f&lt;\/button>\n&lt;\/form>\n{{if . }}\n&lt;div>\n    {{.Message}}\n&lt;\/div>\n{{end}}\n&lt;\/body>\n&lt;\/html>\n{{end}}<\/code><\/pre>\n\n\n\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0447\u0435\u0440\u0435\u0437 go run main.go \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043d\u0430 <a href=\"http:\/\/localhost:8080\/signup\">http:\/\/localhost:8080\/signup<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"996\" height=\"698\" src=\"https:\/\/atonko.ru\/wp-content\/uploads\/2022\/02\/image-9.png\" alt=\"\" class=\"wp-image-630\" srcset=\"https:\/\/alextonkonogov.ru\/wp-content\/uploads\/2022\/02\/image-9.png 996w, https:\/\/alextonkonogov.ru\/wp-content\/uploads\/2022\/02\/image-9-300x210.png 300w, https:\/\/alextonkonogov.ru\/wp-content\/uploads\/2022\/02\/image-9-768x538.png 768w\" sizes=\"auto, (max-width: 996px) 100vw, 996px\" \/><\/figure>\n\n\n\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 application.go \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u0434\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0444\u043e\u0440\u043c\u044b \u0438 \u043c\u0435\u0442\u043e\u0434-\u0445\u0435\u043d\u0434\u043b\u0435\u0440,  \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u043b\u043e\u0433\u0438\u043a\u0443.<\/p>\n\n\n\n<p>\u0412 Routes \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c r.POST(&#8220;\/signup&#8221;, a.Signup):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go\">func (a app) Routes(r *httprouter.Router) {\n\tr.ServeFiles(\"\/public\/*filepath\", http.Dir(\"public\"))\n\tr.GET(\"\/\", a.authorized(a.StartPage))\n\tr.GET(\"\/login\", func(rw http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t\ta.LoginPage(rw, \"\")\n\t})\n\tr.POST(\"\/login\", a.Login)\n\tr.GET(\"\/logout\", a.Logout)\n\tr.GET(\"\/signup\", func(rw http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\t\ta.SignupPage(rw, \"\")\n\t})\n\tr.POST(\"\/signup\", a.Signup)\n}<\/code><\/pre>\n\n\n\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434-\u0445\u0435\u043d\u0434\u043b\u0435\u0440:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go\">func (a app) Signup(rw http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tname := strings.TrimSpace(r.FormValue(\"name\"))\n\tsurname := strings.TrimSpace(r.FormValue(\"surname\"))\n\tlogin := strings.TrimSpace(r.FormValue(\"login\"))\n\tpassword := strings.TrimSpace(r.FormValue(\"password\"))\n\tpassword2 := strings.TrimSpace(r.FormValue(\"password2\"))\n\tif name == \"\" || surname == \"\" || login == \"\" || password == \"\" {\n\t\ta.SignupPage(rw, \"\u0412\u0441\u0435 \u043f\u043e\u043b\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b!\")\n\t\treturn\n\t}\n\tif password != password2 {\n\t\ta.SignupPage(rw, \"\u041f\u0430\u0440\u043e\u043b\u0438 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442! \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0435\")\n\t\treturn\n\t}\n\thash := md5.Sum([]byte(password))\n\thashedPass := hex.EncodeToString(hash[:])\n\terr := a.repo.AddNewUser(a.ctx, name, surname, login, hashedPass)\n\tif err != nil {\n\t\ta.SignupPage(rw, fmt.Sprintf(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f: %v\", err))\n\t\treturn\n\t}\n\ta.LoginPage(rw, fmt.Sprintf(\"%s, \u0432\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b! \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438\", name))\n}<\/code><\/pre>\n\n\n\n<p>\u0427\u0442\u043e \u0443 \u043d\u0430\u0441 \u0437\u0434\u0435\u0441\u044c \u0437\u0430 \u043f\u043e\u0440\u0442\u044f\u043d\u043a\u0430 \u0441 \u043a\u043e\u0434\u043e\u043c:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0444\u043e\u0440\u043c\u044b;<\/li><li>\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u043f\u0443\u0441\u0442\u044b\u0435;<\/li><li>\u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u0438;<\/li><li>\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0445\u0435\u0448 \u043f\u0430\u0440\u043e\u043b\u044f;<\/li><li>\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0431\u0430\u0437\u0443;<\/li><\/ul>\n\n\n\n<p>\u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0438\u0434\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a, \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u043e\u0441\u0442\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c, \u0432 \u0447\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0430. \u041d\u0443 \u0430 \u0435\u0441\u043b\u0438, \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u043e \u043f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n\n\n\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (\u0444\u0430\u0439\u043b login.html) \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0430\u0448\u0443 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u0444\u043e\u0440\u043c\u044b \u043a \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0443:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"markup\" class=\"language-markup\">{{define \"login\"}}\n&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n&lt;head>\n    &lt;meta charset=\"UTF-8\">\n    &lt;title>Login page&lt;\/title>\n&lt;\/head>\n&lt;body>\n&lt;form id=\"loginForm\" name=\"loginForm\" action=\"\/login\" method=\"post\" class=\"mt-4\">\n    &lt;label for=\"login\">\u041b\u043e\u0433\u0438\u043d&lt;\/label>&lt;br>\n    &lt;input type=\"login\" id=\"login\" name=\"login\" autocomplete=\"on\">&lt;br>\n    &lt;label for=\"password\">\u041f\u0430\u0440\u043e\u043b\u044c&lt;\/label>&lt;br>\n    &lt;input type=\"password\" id=\"password\" name=\"password\" autocomplete=\"on\">&lt;br>\n    &lt;br>\n    &lt;button type=\"submit\" name=\"submitBtn\">\u0412\u043e\u0439\u0442\u0438&lt;\/button>\n&lt;\/form>\n{{if . }}\n&lt;div>\n    {{.Message}}\n&lt;\/div>\n{{end}}\n&lt;br>\n&lt;a href=\"\/signup\">\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f&lt;\/a>\n&lt;\/body>\n&lt;\/html>\n{{end}}<\/code><\/pre>\n\n\n\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<\/p>\n\n\n\n<div class=\"wp-block-columns has-2-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/atonko.ru\/wp-content\/uploads\/2022\/02\/image-11.png\" alt=\"\" class=\"wp-image-632\"\/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/atonko.ru\/wp-content\/uploads\/2022\/02\/image-12.png\" alt=\"\" class=\"wp-image-633\"\/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0432 \u0431\u0430\u0437\u0435, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0441\u044f. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"339\" src=\"https:\/\/atonko.ru\/wp-content\/uploads\/2022\/02\/image-10-1024x339.png\" alt=\"\" class=\"wp-image-631\" srcset=\"https:\/\/alextonkonogov.ru\/wp-content\/uploads\/2022\/02\/image-10-1024x339.png 1024w, https:\/\/alextonkonogov.ru\/wp-content\/uploads\/2022\/02\/image-10-300x99.png 300w, https:\/\/alextonkonogov.ru\/wp-content\/uploads\/2022\/02\/image-10-768x254.png 768w, https:\/\/alextonkonogov.ru\/wp-content\/uploads\/2022\/02\/image-10-1536x509.png 1536w, https:\/\/alextonkonogov.ru\/wp-content\/uploads\/2022\/02\/image-10-1568x519.png 1568w, https:\/\/alextonkonogov.ru\/wp-content\/uploads\/2022\/02\/image-10.png 1648w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/atonko.ru\/wp-content\/uploads\/2022\/02\/image-13.png\" alt=\"\" class=\"wp-image-634\"\/><\/figure>\n\n\n\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 pull request: <a href=\"https:\/\/github.com\/alextonkonogov\/atonko-authorization\/pull\/4\">https:\/\/github.com\/alextonkonogov\/atonko-authorization\/pull\/4<\/a><\/p>\n\n\n\n<p>\u041f\u0440\u043e\u0448\u0443 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445. \u041c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u0432 \u043d\u0435\u043c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c, \u043e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u0431\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u043b\u043e \u0438 \u0431\u0435\u0437 \u0442\u043e\u0433\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b. \u041e\u0447\u0435\u043d\u044c \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u0438 \u0441 \u043c\u043e\u0438\u043c\u0438 \u0443\u0440\u043e\u043a\u0430\u043c\u0438 \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u043e\u0433\u043e-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u0438. \u0412\u0441\u0435\u043c \u0434\u043e\u0431\u0440\u0430 \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f: \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u0444\u043e\u0440\u043c\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438; \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u0434\u043b\u044f \u043f\u0440\u0438\u0435\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0444\u043e\u0440\u043c\u044b \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043b\u043e\u0433\u0438\u043a\u0438; \u043c\u0435\u0442\u043e\u0434, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0431\u0430\u0437\u0443. \u041d\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-628","post","type-post","status-publish","format-standard","hentry","category-golang"],"_links":{"self":[{"href":"https:\/\/alextonkonogov.ru\/index.php?rest_route=\/wp\/v2\/posts\/628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alextonkonogov.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alextonkonogov.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alextonkonogov.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alextonkonogov.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=628"}],"version-history":[{"count":2,"href":"https:\/\/alextonkonogov.ru\/index.php?rest_route=\/wp\/v2\/posts\/628\/revisions"}],"predecessor-version":[{"id":782,"href":"https:\/\/alextonkonogov.ru\/index.php?rest_route=\/wp\/v2\/posts\/628\/revisions\/782"}],"wp:attachment":[{"href":"https:\/\/alextonkonogov.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alextonkonogov.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alextonkonogov.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}