{"id":256462,"date":"2015-05-01T20:22:01","date_gmt":"2015-05-01T16:22:01","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=256462"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=256462","title":{"rendered":"\u041f\u0438\u0448\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438\u043d\u0432\u0430\u0439\u0442\u043e\u0432 (\u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439) \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e Meteor \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f"},"content":{"rendered":"<p>     \t\u041f\u0440\u0438\u0432\u0435\u0442.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0443\u044e, \u043d\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 Email-\u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e Meteor \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u044e\u0434\u0435\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u043d\u0430\u0434 \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0443\u0447\u0435\u0431\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u044e\u0434\u0435\u0439 \u0438\u043b\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043f\u0440\u043e\u0434\u0443\u043a\u0446\u0438\u0438 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438.<\/p>\n<p>  \u0412 \u0441\u0435\u0442\u0438 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u0438 CoffeScript, \u043d\u043e \u043c\u043d\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0442\u0430\u043c \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438\u043d\u0432\u0430\u0439\u0442\u043e\u0432 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0435\u044e \u0441 \u0445\u0430\u0431\u0440\u0430\u0436\u0438\u0442\u0435\u043b\u044f\u043c\u0438.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043d\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0443\u043c\u0435\u0442\u044c:<br \/>  1) \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 \u0438 \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u043e\u0432\u043e\u0433\u043e;<br \/>  2) \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445;<br \/>  3) \u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u043c\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439;<br \/>  4) \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043d\u0430 email;<br \/>  5) \u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0440\u043e\u043b\u044f\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439;<br \/>  6) \u0410\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439;<br \/>  7) \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0443\u0447\u0443 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/p>\n<p>  <b>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435:<\/b> \u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0436\u0438\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043a \u0441\u0435\u0431\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f\u2026<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0427\u0442\u043e \u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f? \u0412\u043e \u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b:  <\/p>\n<pre><code class=\"javascript\">accounts-base - \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u043c accounts-google - \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0433\u0443\u0433\u043b\u0430 accounts-password - \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e  \u043b\u043e\u0433\u0438\u043d\u0443\/\u043f\u0430\u0440\u043e\u043b\u044e accounts-ui - \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441  \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 alanning:roles - \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u044f\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 aldeed:autoform - \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0444\u043e\u0440\u043c aldeed:collection2 - \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0445\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446 \u0411\u0414 email - \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0438\u0441\u044c\u043c\u0430 iron:router - \u0441\u0430\u043c\u044b\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0440\u043e\u0443\u0442\u0435\u0440 mizzao:bootboxjs - \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f random - \u044d\u0442\u043e\u0439 \u0448\u0442\u0443\u043a\u043e\u0439 \u0431\u0443\u0434\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434\u044b \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 <\/code><\/pre>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <a href=\"http:\/\/fezvrasta.github.io\/bootstrap-material-design\/\">Material Design for Bootstrap<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<\/p>\n<h4>\u041f\u0435\u0440\u0432\u043e\u0435 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043e\u043f\u0438\u0448\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 \u0438 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u043d\u0430\u043c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c.<\/p>\n<p>  <b>\u0424\u0430\u0439\u043b lib\/constants.js<\/b>  <\/p>\n<pre><code class=\"javascript\">\/\/\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043e \u0432 \u0411\u0414 \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 INVITE_CREATED = 0; \/\/\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u043d\u0430 Email \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b \u0430\u043d\u0442\u0438\u0441\u043f\u0430\u043c - \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0435\u0433\u043e \u0443\u0432\u0438\u0434\u0438\u0442 INVITE_EMAILED = 1; \/\/\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438 \u043e\u043d \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f INVITE_COMPLETED = 2; <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435, \u043d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0445\u0435\u043b\u043f\u0435\u0440\u043e\u0432.<\/p>\n<p>  <b>\u0424\u0430\u0439\u043b lib\/helpers.js<\/b>  <\/p>\n<pre><code class=\"javascript\">\/\/\u044d\u0442\u0438 \u0445\u0435\u043b\u043f\u0435\u0440\u044b \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043f\u043e\u0436\u0442\u043e\u043c\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 if (Meteor.isClient) {     \/\/\u0438\u0449\u0435\u043c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e \u0442\u0435\u043a\u0443\u0449\u0435\u0433 \u043e\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0435\u0451 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c, \u0442\u0430\u043a \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0451\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c     Template.registerHelper('userCompany', function () {         var company = Company.findOne({userId: Meteor.userId()});         if (company == undefined) {             if (Meteor.userId() != null) {                 var user = Meteor.users.findOne({_id: Meteor.userId()}, {fields: {'companyId': 1}});                 company = Company.findOne({_id: user.companyId});             }         }         return company;     });      \/\/\u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 Email \u043d\u0430 \u0444\u043e\u0440\u043c\u0435 \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440     Template.registerHelper('validateEmail', function (email) {         var re = \/\\S+@\\S+\\.\\S+\/;         return re.test(email);     }); } <\/code><\/pre>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 (\u043f\u043e\u0444\u0438\u0433\u0443 \u043a\u0430\u043a\u0438\u0435). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u0435\u043a\u0443\u044e \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 (\u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u044b, \u043a\u043e\u043c\u0443 \u043a\u0430\u043a \u0443\u0434\u043e\u0431\u043d\u043e) \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044e \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.<\/p>\n<h4>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430<\/h4>\n<p>  \u041e\u043f\u0438\u0448\u0435\u043c \u0441\u0445\u0435\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Simple Schema \u0438 \u043f\u0430\u043a\u0435\u0442\u0430 aldeed:collection2.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0439 \u043e\u043f\u0438\u0448\u0435\u043c \u0441\u0445\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, id \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0441\u043e\u0437\u0434\u0430\u0432\u0448\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e. \u0434\u0430\u0442\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0434\u0430\u0442\u0443 \u0435\u0451 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u043a:  <\/p>\n<ul>\n<li>type \u2014 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u0442\u0438\u043f \u043f\u043e\u043b\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u044b<\/li>\n<li>min, max \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/li>\n<li>autoValue \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u044f<\/li>\n<li>denyInsert, denyUpdate \u2014 \u0437\u0430\u043f\u0440\u0435\u0442 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043f\u043e\u043b\u0435 \u043f\u0440\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0435\/\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438<\/li>\n<li>optional \u2014 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u043e\u043b\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c<\/li>\n<\/ul>\n<p>  <b>\u0424\u0430\u0439\u043b lib\/collections\/company.js<\/b>  <\/p>\n<pre><code class=\"php\">Company = new Mongo.Collection('company');  \/\/\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b if (Meteor.isServer) {     Meteor.methods({         \/\/\u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438. \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0448\u0438\u0439 \u0435\u0451 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0442\u0430\u0442\u044c \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u043c         registerAdminUser: function(companyId, userId) {             check(companyId, String);             check(userId, String);             Roles.addUsersToRoles(Meteor.userId(), [&quot;CompanyAdmin&quot;]);         }     }); }  \/\/SimpleSchema.debug = true;  \/\/\u0441\u0445\u0435\u043c\u0430 Company.attachSchema(new SimpleSchema({     \/\/\u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438   title: {     type: String,     label: &quot;\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435&quot;,     min: 3,     max: 200   },     \/\/\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438   description: {     type: String,     label: &quot;\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435&quot;,     min: 20,     max: 1000,     autoform: {       rows: 5     }   },     \/\/id \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0448\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e. \u0412 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043e\u043d \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0435\u0451 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u0438 \u0430\u0434\u043c\u0438\u043d\u043e\u043c.   userId: {     type: String,     autoValue: function() {       if (this.isInsert) {         return Meteor.userId();       } else {         this.unset();       }     },     label: &quot;\u0412\u043b\u0430\u0434\u0435\u043b\u0435\u0446&quot;,     \/\/denyInsert: true,     denyUpdate: true,     optional: true   },     \/\/\u0434\u0430\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f. \u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438   createdAt: {     type: Date,     autoValue: function() {       if (this.isInsert) {         return new Date;       } else if (this.isUpsert) {         return {$setOnInsert: new Date};       } else {         this.unset();       }     },     denyUpdate: true,     optional: true   },   \/\/ \u0434\u0430\u0442\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f. \u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438   updatedAt: {     type: Date,     autoValue: function() {       if (this.isUpdate) {         return new Date();       }     },     denyInsert: true,     optional: true   }, })); <\/code><\/pre>\n<p>  \u0422\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0438\u0448\u0435\u043c \u0441\u0445\u0435\u043c\u0443 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0438\u043d\u0432\u0430\u0439\u0442\u043e\u0432. \u041d\u0430\u0448 \u0444\u0430\u0439\u043b \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u0440\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430 \u2014 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. \u041a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c email \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c\u043e\u0433\u043e, \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438, \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f, \u043f\u043e\u043b\u0435 \u0441\u0432\u044f\u0437\u0438 \u0441 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0432\u0448\u0438\u043c \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0441\u0432\u044f\u0437\u044c \u0441 \u0432\u044b\u0441\u043b\u0430\u0432\u0448\u0438\u043c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438 \u0434\u0430\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\/\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u0447\u0451\u043c, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043f\u043e\u043b\u0435 \u00ab\u0414\u0430\u0442\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u00bb \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e \u0434\u0430\u0442\u0435 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f, \u0430 \u043f\u043e\u043b\u0435 \u00ab\u0414\u0430\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\u00bb \u2014 \u0434\u0430\u0442\u0435 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0435\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438.<\/p>\n<p>  <b>\u0424\u0430\u0439\u043b lib\/collections\/invite.js<\/b>  <\/p>\n<pre><code class=\"javascript\">Invite = new Mongo.Collection('invite');  \/\/SimpleSchema.debug = true;  \/\/\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b if (Meteor.isServer) {     Meteor.methods({         \/\/\u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043d\u0430 email         invationSender: function (email) {             check(this.userId, String);             check(email, String);              \/\/\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043a\u0435\u043d. \u0415\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0430 Email             var token = Random.hexString(10);              \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043c\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u0442\u0435\u043a\u0441\u0442 \u043f\u0438\u0441\u044c\u043c\u0430.             var company = Company.findOne({userId: this.userId});             var companyName = company.title;              \/\/\u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0432 \u0411\u0414             \/\/\u0425\u0440\u0430\u043d\u0438\u043c \u0441\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 - \u043f\u043e\u0441\u0442\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441, \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0438 \u0441\u0442\u0430\u0442\u0443\u0441             var inviteId = Invite.insert({email:email,token:token,status:INVITE_CREATED});              \/\/\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0430 \u0432\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0434\u0435\u043b\u0430\u0435\u043c \u0432 \u0444\u043e\u043d\u0435             this.unblock();              \/\/\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0438\u0441\u044c\u043c\u043e \u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435\u043c             \/\/\u0412 \u0442\u0435\u043a\u0441\u0442\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f, \u0438\u043c\u044f \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438             Email.send({                 to: email,                 from: 'info@forsk.ru',                 subject: '\u041f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u0435\u0441\u044c \u043a \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 '+companyName+' \u0432 \u043e\u043d\u043b\u0430\u0439\u043d \u0442\u0430\u0431\u0435\u043b\u0435 \u0443\u0447\u0451\u0442\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 Kellot.ru',                 html: '\u041f\u0440\u0438\u0432\u0435\u0442! \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u0430\u0439\u0442\u0430 Kellot.Ru \u043f\u043e\u0434 \u0438\u043c\u0435\u043d\u0435\u043c '+Meteor.user().profile.name+' \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u0442 \u0412\u0430\u0441 ' +                     '\u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043a \u0432\u0435\u0434\u0435\u043d\u0438\u044e \u0442\u0430\u0431\u0435\u043b\u044f \u0443\u0447\u0451\u0442\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 &quot;'+companyName+'&quot;. ' +                     '&lt;br\/&gt;&lt;br\/&gt;\u0412\u0430\u0448 \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f: '+token+                     '&lt;br\/&gt;&lt;br\/&gt;\u0427\u0442\u043e\u0431\u044b \u0432\u043e\u0439\u0442\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u043f\u0440\u043e\u0439\u0434\u0438\u0442\u0435 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 ' +                     '&lt;a href=&quot;http:\/\/p.kellot.ru\/company\/invite\/'+token+'&quot;&gt;http:\/\/p.kellot.ru\/company\/invite\/'+token+'&lt;\/a&gt; ' +                     ' \u0438 \u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c. \u0412\u0430\u0448 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.'+                     '&lt;br\/&gt;&lt;br\/&gt;\u0421 \u0443\u0432\u0430\u0436\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043e\u043d\u043b\u0430\u0439\u043d \u0442\u0430\u0431\u0435\u043b\u044f \u0443\u0447\u0451\u0442\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 Kellot.Ru'             });              \/\/\u041e\u0431\u043d\u043e\u043b\u0432\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0441 &quot;\u0441\u043e\u0437\u0434\u0430\u043d\u043e&quot; \u043d\u0430 &quot;\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e&quot;             Invite.update({_id:inviteId}, {$set: {status: INVITE_EMAILED}}, {}, function(error, count) {                 console.log('update error', error, count);             });             return true;         },         \/\/\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043a\u043e\u043c\u043f\u0430\u043d\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442 \u044c\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043f\u0440\u0438\u0433\u0430\u0448\u0435\u043d\u0438\u044f         deleteInvite: function(inviteId) {             check(inviteId, String);             var invite = Invite.findOne({_id: inviteId});             \/\/\u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 &quot;\u043f\u0440\u0438\u043d\u044f\u0442\u043e&quot; \u0442\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c.             \/\/ \u0418\u043d\u0430\u0447\u0435 \u0443\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439             if (invite.status != INVITE_COMPLETED) {                 Invite.remove({_id: inviteId});                 return true;             } else {                 return false;             }         },         \/\/\u041c\u0435\u0442\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f         activateInviteToken: function (activationToken, userId) {             check(this.userId, String);             check(activationToken, String);             check(userId, String);              \/\/\u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 - \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e \u0438 \u0438\u043d\u0432\u0430\u0439\u0442             var user = Meteor.users.findOne({_id:userId});             var invite = Invite.findOne({token:activationToken});             var company = Company.findOne({_id:invite.companyId});              \/\/\u0435\u0441\u043b\u0438 \u0438\u043d\u0432\u0430\u0439\u0442 \u0443\u0436\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d - \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0448\u0438\u0431\u043a\u0443             if (invite.status == INVITE_COMPLETED) {                 return false;             }              \/\/\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u043a \u043d\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438             Meteor.users.update({_id:userId}, { $set: {companyId: company._id } });              \/\/\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0441 \u043d\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c             Invite.update({_id:invite._id}, { $set: {invitedUserId: userId, status: 2 } });              \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432             Roles.addUsersToRoles(Meteor.userId(), [&quot;CompanyMember&quot;]);              return true;         }     }); }  \/\/\u0441\u0445\u0435\u043c\u0430 Invite.attachSchema(new SimpleSchema({     \/\/Email \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441 \u0444\u043e\u0440\u043c\u044b, \u043d\u0430 \u043d\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u043f\u0440\u0438\u0433\u043b\u0448\u0435\u043d\u0438\u0435     email: {         type: String,         label: &quot;\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \/ Email&quot;,         min: 3,         max: 30     },     \/\/\u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f. \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435     token: {         type: String,         label: &quot;\u041a\u043e\u0434 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f&quot;,         min: 10,         max: 10     },     \/\/\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f     status: {         type: Number,         label: &quot;\u0421\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f&quot;     },     \/\/\u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435     invitedUserId: {         type: String,         label: &quot;\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u0433\u0430\u0448\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f&quot;,         optional: true     },     \/\/\u043a\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435?     creator: {         type: String,         label: &quot;\u0421\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044c&quot;,         autoValue: function() {             if (this.isInsert) {                 return Meteor.userId();             } else {                 this.unset();             }         },         denyUpdate: true,         optional: true     },     \/\/\u0421\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0441 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439     companyId: {         type: String,         autoValue: function() {             if (this.isInsert) {                 return Company.findOne({userId:Meteor.userId()})._id;             } else {                 this.unset();             }         },         label: &quot;\u041a\u043e\u043c\u043f\u0430\u043d\u0438\u044f&quot;,         denyUpdate: true,         optional: true     },     \/\/\u0434\u0430\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f     createdAt: {         type: Date,         autoValue: function() {             if (this.isInsert) {                 return new Date;             } else if (this.isUpsert) {                 return {$setOnInsert: new Date};             } else {                 this.unset();             }         },         denyUpdate: true,         optional: true     },     \/\/\u0434\u0430\u0442\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f.     \/\/\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0434\u0430\u0442\u043e\u0439 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438     updatedAt: {         type: Date,         autoValue: function() {             if (this.isUpdate) {                 return new Date();             }         },         denyInsert: true,         optional: true     } })); <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0438 \u0432\u0441\u0451, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u043e\u0441\u0442\u0430 \u043a\u0430\u043a \u0434\u0432\u0430\u0436\u0434\u044b \u0434\u0432\u0430: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e (\u0433\u0440\u0443\u043f\u043f\u0443). \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0435\u0451 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c \u0438 \u0440\u0430\u0441\u0441\u044b\u043b\u0430\u0435\u0442 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c. \u0415\u0441\u043b\u0438 \u043e\u043d \u043f\u0435\u0440\u0435\u0434\u0443\u043c\u0430\u043b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435, \u0442\u043e \u043f\u043e\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b \u2014 \u0430\u0434\u043c\u0438\u043d \u0432\u043f\u0440\u0430\u0432\u0435 \u0435\u0433\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0438 \u0442\u043e\u0433\u0434\u0430 \u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0432 \u043f\u0438\u0441\u044c\u043c\u0435 \u2014 \u0442\u043e \u043e\u043d \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0436\u0430\u0432 \u043a\u043d\u043e\u043f\u043a\u0443 \u00ab\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f\u00bb. \u041d\u043e \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u0440\u043e\u0443\u0442\u0435\u0440 \u043a\u043e\u0435 \u0447\u0435\u043c\u0443\u2026<\/p>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0412\u0430\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 email. Meteor \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <a href=\"http:\/\/www.mailgun.com\/\">Mailgun<\/a>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u043e 200 \u043f\u0438\u0441\u0435\u043c \u0432 \u0434\u0435\u043d\u044c \u0438\u043b\u0438 \u0434\u043e 10 000 \u043f\u0438\u0441\u0435\u043c \u0432 \u043c\u0435\u0441\u044f\u0446. \u041d\u043e \u043d\u0438\u0447\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0412\u0430\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0438\u043b\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f MAIL_URL.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: \u00abMAIL_URL\u00bb: \u00absmtp:\/\/user:password@domain.ru:587\/\u00bb. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0438\u0441\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0412\u0430\u043c\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0435.<\/p>\n<p>  <b>\u0412\u0430\u0436\u043d\u043e!<\/b> \u0411\u0443\u0434\u044c\u0442\u0435 \u0431\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b, \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0451\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f meteor-up \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0444\u0430\u0439\u043b mup.json, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0442\u043e \u043d\u0435 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0439\u0442\u0435 \u0441\u0432\u043e\u0439 \u043a\u043e\u0434 \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u0445 \u043d\u0430 github \u0438\u043b\u0438 \u0435\u0449\u0451 \u0433\u0434\u0435-\u0442\u043e. \u0418\u043d\u0430\u0447\u0435 \u0412\u0430\u0448\u0443 \u043f\u043e\u0447\u0442\u0443 \u0441\u043c\u043e\u0433\u0443\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0441\u0435 \u043a\u043e\u043c\u0443 \u043d\u0435 \u043b\u0435\u043d\u044c.<\/p>\n<h4>\u0420\u043e\u0443\u0442\u0435\u0440 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/h4>\n<p>  Iron Router \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0441\u044b\u043b\u043a\u0438 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u043e\u0432\u0438\u0447\u043e\u043a \u0438\u0437 \u043f\u0438\u0441\u044c\u043c\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u0434\u0432\u0443\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445:  <\/p>\n<ol>\n<li>\u041f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043a \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439;<\/li>\n<li>\u0415\u0441\u0442\u044c \u043b\u0438 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438.<\/li>\n<\/ol>\n<p>  <b>\u0424\u0430\u0439\u043b lib\/router.js<\/b>  <\/p>\n<pre><code class=\"javascript\">Router.map(function () { ...     \/\/\u0420\u043e\u0443\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0435\u0440\u0435\u0448\u0435\u0434\u0448\u0435\u043c\u0443 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435     this.route('activateInviteToCompany', {         trackPageView: true,         path: '\/company\/invite\/:activationToken',         waitOn: function () {             \/\/\u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043e\u0434\u0438\u043d \u0438\u043d\u0432\u0430\u0439\u0442, \u043e\u0434\u043d\u0443 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u043b             Meteor.subscribe(&quot;inviteToken&quot;, Router.current().params.activationToken);             Meteor.subscribe('companyToken', Router.current().params.activationToken);             return Meteor.subscribe('userToken', Router.current().params.activationToken);         }     }); ... Router.onBeforeAction(function (pause) {      Alerts.removeSeen();     \/\/\u043d\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0435 \u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0447\u043d\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446     if (Meteor.userId() == null) {         if (pause.url != '\/index'             && pause.url != '\/'             && pause.url != '\/reviews'             && pause.url != '\/company\/invite\/'+Router.current().params.activationToken) {             Router.go('index');         }     }      \/\/ \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d, \u043d\u043e \u0435\u0449\u0451 \u043d\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043d\u0438 \u043a \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438,     \/\/ \u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0433\u0438\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u0441\u0441\u0438\u0438     \/\/ \u0434\u043b\u044f \u0435\u0433\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043d\u0435\u0442,     \/\/ \u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043c \u0435\u043c\u0443 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e \u0438 \u0441\u0442\u0430\u0442\u044c \u0435\u0451 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u043c     if (Meteor.isClient && Meteor.userId() != null) {          \/\/\u0415\u0441\u043b\u0438 \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043d\u0438 \u043a \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438...         if (UI._globalHelpers.userCompany() == undefined &&             (pause.url != '\/firstLogin'             && pause.url != '\/company\/register'             )) {              \/\/... \u0438 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435, \u0442\u043e...             if (Session.get('activationToken') != undefined) {                 \/\/\u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0438 \u0433\u0440\u043e\u0445\u043d\u0435\u043c \u0435\u0433\u043e \u0438\u0437 \u0441\u0435\u0441\u0441\u0438\u0438                 var activationToken = Session.get('activationToken');                 Session.set('activationToken', undefined);                  \/\/\u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043d\u0432\u0430\u0439\u0442\u0430 \u043f\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044e                 var invite = Invite.findOne({ token: activationToken });                  \/\/\u0432\u044b\u0437\u043e\u0432\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f                 Meteor.call('activateInviteToken', activationToken, Meteor.userId(), function (error, result) {                     \/\/\u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c                     if (error) {                         \/\/\u043b\u0438\u0431\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435...                         console.log(error);                         bootbox.alert(&quot;\u041e\u0448\u0438\u0431\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u0432 \u0441\u043b\u0443\u0436\u0431\u0443 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438! \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438: &quot; + error.reason);                     } else {                         \/\/\u043b\u0438\u0431\u043e \u0441\u043e\u043e\u0431\u0449\u0438\u043c \u043e\u0431 \u0443\u0441\u043f\u0435\u0445\u0435 \u0438 \u043f\u043e\u0434\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u043d\u0430 \u0432\u0441\u0435 \u043d\u0443\u0436\u043d\u044b\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438!                         Meteor.subscribe('company');                         Meteor.subscribe('invite');                         bootbox.alert(&quot;\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043e!&quot;);                     }                 });             } else {                 \/\/\u0435\u0441\u043b\u0438 \u0436\u0435 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 - \u043f\u043e\u0448\u043b\u0451\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043b\u0435\u0441\u043e\u043c                 \/\/ (\u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438)                 Router.go('firstLoginForm');             }         }     }      this.next(); }); }); <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043a\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u0442 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 &#8216;\/company\/invite\/&lt;\u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438&gt;&#8217;, \u0442\u043e \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d \u0448\u0430\u0431\u043b\u043e\u043d activateInviteToCompany, \u0430 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0438, \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435, \u043f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u0432\u0448\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>  \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0436\u0435 onBeforeAction \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<\/p>\n<p>  \u0412\u043e \u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043c\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043e\u0442\u0437\u044b\u0432\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0438\u043d\u0432\u0430\u0439\u0442\u0430. \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u2014 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u043a\u0443\u0434\u0430 \u0431\u044b \u043e\u043d \u043d\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043f\u043e\u043f\u0430\u0441\u0442\u044c.<\/p>\n<p>  \u0412\u043e \u0432\u0442\u043e\u0440\u044b\u0445, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0442\u0430\u043a\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d, \u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0433\u043e \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u043a \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 \u2014 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u043b\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430. \u0415\u0441\u043b\u0438 \u044d\u0442\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u2014 \u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>  \u0412 \u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0441\u0451 \u0436\u0435 \u043d\u0435 \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0451\u043d \u043d\u0438 \u0437\u0430 \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0435\u0439, \u043c\u044b \u0438\u0449\u0435\u043c \u0432 \u0441\u0435\u0441\u0441\u0438\u0438 \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0432\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u2014 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0443 \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e.<\/p>\n<p>  \u0412\u0441\u0451 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u043e \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0432\u0438\u0434\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0432 \u0441\u0435\u0441\u0441\u0438\u0438. \u041a\u0430\u043a \u0442\u0430\u043a? \u041e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438. \u0421\u0443\u0434\u044f \u043f\u043e \u043a\u043e\u0434\u0443 \u0432 \u0440\u043e\u0443\u0442\u0435\u0440\u0435 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0438, \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0437\u0430\u0447\u0435\u043c.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:<br \/>  <b>\u0424\u0430\u0439\u043b server\/publications.js<\/b>  <\/p>\n<pre><code class=\"javascript\">\/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u043e \u043a\u043e\u0434\u0443 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f function getCompanyByInviteToken(tokenId) {     var invite = Invite.findOne({ token: tokenId });     var company = Company.findOne({ _id: invite.companyId });     \/\/console.log('getCompanyByInviteToken', tokenId, invite.companyId, company._id);     return company; } ... Meteor.publish('inviteToken', function (tokenId) {     check(tokenId, Match.Any);      return Invite.find({ token: tokenId }); });  Meteor.publish('companyToken', function (tokenId) {     check(tokenId, Match.Any);     var company = getCompanyByInviteToken(tokenId);      return Company.find({_id:company._id}); });  Meteor.publish('userToken', function (tokenId) {     check(tokenId, Match.Any);      var company = getCompanyByInviteToken(tokenId);          return Meteor.users.find({ _id: company.userId },         {fields: {'services':0, 'roles':0, createdAt:0}}); }); <\/code><\/pre>\n<p>  \u0422\u0430\u043a, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u0431\u0440\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u0434\u0443\u043c\u0430\u044e \u0438 \u044d\u0442\u043e \u043b\u0438\u0448\u043d\u0435\u0435.<\/p>\n<h4>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/h4>\n<p>  \u0412\u0441\u044f \u043d\u0430\u0448\u0430 \u043b\u043e\u0433\u0438\u043a\u0430 \u043d\u0438\u0447\u0442\u043e \u0431\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u0412\u0435\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0443 \u043d\u0430\u0441 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432:  <\/p>\n<ul>\n<li>inviteList \u2014 \u043f\u0430\u043d\u0435\u043b\u044c \u0441 \u043f\u0435\u0440\u0435\u0447\u043d\u0435\u043c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 \u0438 \u0444\u043e\u0440\u043c\u043e\u0447\u043a\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f;<\/li>\n<li>inviteSend \u0438 inviteSend \u2014 \u0444\u043e\u0440\u043c\u0430 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u043e\u043b\u0435\u0439 (\u0443 \u043d\u0430\u0441 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e);<\/li>\n<li>activateInviteToCompany \u2014 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0431 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c\u043e\u043c \u044d\u0442\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0438.<\/li>\n<\/ul>\n<p>  <b>\u0424\u0430\u0439\u043b client\/views\/invite\/invite.html<\/b>  <\/p>\n<pre><code class=\"javascript\">&lt;template name=&quot;inviteList&quot;&gt;     &lt;div class=&quot;panel panel-success&quot; style=&quot;float: left; margin-right: 20px;&quot;&gt;         &lt;div class=&quot;panel-heading&quot;&gt;             &lt;h3 class=&quot;panel-title&quot;&gt;\u041f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u0432!&lt;\/h3&gt;         &lt;\/div&gt;          &lt;div class=&quot;panel-body&quot;&gt;             {{#if invitedUsers.count}}                 &lt;div class=&quot;list-group&quot;&gt;                     {{#each invitedUsers}}                         &lt;div class=&quot;list-group-item&quot;&gt;                             &lt;div class=&quot;row-content&quot;&gt;                                 &lt;div class=&quot;least-content&quot;&gt;{{inviteTextStatus}}                                     {{#if isInRole 'CompanyAdmin'}}                                         {{#if inviteIsComplete}}                                         {{else}}                                             &lt;a class=&quot;deleteInviteBtn&quot; data-id=&quot;{{_id}}&quot; href=&quot;#&quot;&gt;x&lt;\/a&gt;                                         {{\/if}}                                     {{\/if}}                                 &lt;\/div&gt;                                 &lt;p class=&quot;list-group-item-text&quot;&gt;{{email}}&lt;\/p&gt;                             &lt;\/div&gt;                         &lt;\/div&gt;                         &lt;div class=&quot;list-group-separator&quot;&gt;&lt;\/div&gt;                     {{\/each}}                 &lt;\/div&gt;             {{else}}                 \u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 \u043d\u0435\u0442!             {{\/if}}         &lt;\/div&gt;          {{#if isInRole 'CompanyAdmin'}}             &lt;div class=&quot;panel-footer&quot;&gt;                     {{&gt; inviteSend}}             &lt;\/div&gt;         {{\/if}}     &lt;\/div&gt; &lt;\/template&gt;  &lt;template name=&quot;inviteSend&quot;&gt;     {{#autoForm collection=&quot;Invite&quot; id=&quot;inviteSend&quot; type=&quot;insert&quot;}}         {{&gt; inviteFieldset}}         &lt;button id=&quot;sendInviteBtn&quot; class=&quot;btn btn-primary&quot; style=&quot;width:100%&quot;&gt;\u041f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u0442\u044c&lt;\/button&gt;     {{\/autoForm}} &lt;\/template&gt;  &lt;template name=&quot;inviteFieldset&quot;&gt;     &lt;fieldset&gt;         {{&gt; afQuickField name='email'}}     &lt;\/fieldset&gt; &lt;\/template&gt;  &lt;template name=&quot;activateInviteToCompany&quot;&gt;     {{#if currentUser}}         \u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435. \u0412\u044b \u0443\u0436\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438.     {{ else }}         {{#if inviteIsActivated}}             \u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 &lt;b&gt;{{userActivationCode}}&lt;\/b&gt; \u0443\u0436\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043e. \u0412\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e.         {{ else }}             \u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435! &lt;br\/&gt;&lt;br\/&gt;              \u0421\u0443\u0434\u044f \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043a \u0443\u0447\u0430\u0441\u0442\u0438\u044e \u0432 \u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043e\u043d\u043b\u0430\u0439\u043d-\u0442\u0430\u0431\u0435\u043b\u044f \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 &lt;b&gt;{{companyNameByInviteCode}}&lt;\/b&gt; \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f &lt;b&gt;{{companyUserNameByInviteCode}}&lt;\/b&gt;.             &lt;br\/&gt;&lt;br\/&gt;             \u041c\u044b \u0443\u0436\u0435 \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u043b\u0438 \u0412\u0430\u0448 \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 &lt;b&gt;{{userActivationCode}}&lt;\/b&gt;  \u0438 \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0412\u0430\u0441 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0443!&lt;br\/&gt;&lt;br\/&gt;             \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0449\u0451\u043b\u043a\u043d\u0438\u0442\u0435 \u043f\u043e \u043f\u0443\u043d\u043a\u0442\u0443 \u043c\u0435\u043d\u044e &quot;\u0412\u043e\u0439\u0442\u0438 \/ \u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f&quot; \u0432 \u043f\u0440\u0430\u0432\u043e\u043c \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0443\u0433\u043b\u0443, \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0434\u043b\u044f \u0412\u0430\u0441 \u043c\u0435\u0442\u043e\u0434 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438             \u0412\u044b \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e \u0441\u0442\u0430\u043d\u0435\u0442\u0435 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u0432 \u0442\u0430\u0431\u0435\u043b\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 &lt;b&gt;{{companyNameByInviteCode}}&lt;\/b&gt;!         {{\/if}}     {{\/if}} &lt;\/template&gt; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u043e\u0442.<\/p>\n<p>  \u0428\u0430\u0431\u043b\u043e\u043d inviteList \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0434\u043b\u044f \u043d\u0430\u0441 \u0444\u043e\u0440\u043c\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 inviteSend \u0438 \u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u0443 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0438. \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0440\u043e\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0431\u043e \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0438 \u043a\u043d\u043e\u043f\u043a\u0430 \u00ab\u0423\u0434\u0430\u043b\u0438\u0442\u044c\u00bb.<\/p>\n<p>  \u0428\u0430\u0431\u043b\u043e\u043d activateInviteToCompany \u0442\u0430\u043a\u0436\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f (\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \/ \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043e) \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f (\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d \/ \u043d\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d) \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043b\u0438\u0431\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043a \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438, \u043b\u0438\u0431\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0440\u0438\u0447\u0438\u043d.<\/p>\n<p>  \u041f\u0440\u0438\u0447\u0451\u043c, \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 activateInviteToCompany \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0442\u043e\u043c \u043a\u0442\u043e, \u0437\u0430\u0447\u0435\u043c \u0438 \u043a\u0443\u0434\u0430 \u0435\u0433\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u0442. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u0448\u0435\u0434\u0448\u0438\u0439 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0438\u0437 \u043f\u0438\u0441\u044c\u043c\u0430 \u043d\u0435 \u0444\u0430\u043a\u0442 \u0447\u0442\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043e\u0442 \u043a\u043e\u0433\u043e \u0432 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441.<\/p>\n<p>  \u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430\u0448 \u0432\u0438\u0434\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439:<br \/>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/b34\/a68\/6ee\/b34a686ee5f24f05be63d88563e3ae98.png\"\/><\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0442\u0430\u043a, \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<br \/>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/b3e\/35e\/0d8\/b3e35e0d8cf34fe0a4e1dfd632a3bd42.png\"\/><\/p>\n<h4>\u041b\u043e\u0433\u0438\u043a\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/h4>\n<p>  \u0424\u0443\u0445\u2026 \u0422\u0440\u0435\u0442\u0438\u0439 \u0447\u0430\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438\u2026<\/p>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e. \u041d\u0430\u043c \u043f\u043e\u0440\u0430 \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043f\u043e\u0432\u0435\u0448\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u043d\u0430 \u043d\u0430\u0448 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u0447\u0430\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432\u043e\u0435\u0434\u0438\u043d\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, <\/p>\n<p>  <b>\u0424\u0430\u0439\u043b client\/views\/invite\/invite.html<\/b>  <\/p>\n<pre><code class=\"javascript\">Template.inviteSend.events({     'click #sendInviteBtn': function () {         \/\/\u043f\u043e\u0443\u043b\u0447\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u0444\u043e\u0440\u043c\u044b Email         var email = $('#inviteSend [name=email]').val();         $('#sendInviteBtn').attr(&quot;disabled&quot;, true);          \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0438\u043d\u0432\u0430\u0439\u0442 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e Email \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435         var existsInvite = Invite.findOne({email:email});         if ( existsInvite == undefined ) {             \/\/\u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0435\u0433 \u0435\u0449\u0451 \u043d\u0435\u0442 - \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c Email \u043d\u0430 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u044c             if (UI._globalHelpers.validateEmail( email )) {                 \/\/\u0415\u0441\u043b\u0438 Email \u043f\u0440\u043e\u0448\u0451\u043b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e - \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u0432\u044b\u0437\u043e\u0432 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438                 Meteor.call('invationSender', email, function (error, result) {                     if (error) {                         \/\/\u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a. \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443                         $('#inviteSend [name=email]').val(&quot;&quot;);                         $('#sendInviteBtn').removeAttr(&quot;disabled&quot;);                         bootbox.alert(&quot;\u041e\u0448\u0438\u0431\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u0432 \u0441\u043b\u0443\u0436\u0431\u0443 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438! \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438: &quot; + error.reason);                     } else {                         \/\/\u0432\u0441\u0451 \u043f\u0443\u0447\u043a\u043e\u043c. \u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e, \u0441\u043f\u0441\u0438\u043e\u043a \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438                         $('#inviteSend [name=email]').val(&quot;&quot;);                         $('#sendInviteBtn').removeAttr(&quot;disabled&quot;);                         Meteor.subscribe('invite', Meteor.userId());                         bootbox.alert(&quot;\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 &quot; + email);                     }                 });             } else {                 \/\/\u0415\u0441\u043b\u0438 Email \u043d\u0435 \u043f\u0440\u043e\u0448\u0451\u043b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e - \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e                 $('#inviteSend [name=email]').val(&quot;&quot;);                 $('#sendInviteBtn').removeAttr(&quot;disabled&quot;);                 bootbox.alert(&quot;Email \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442\u0443 email@example.ru!&quot;);             }         } else {             \/\/\u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0433\u043e Email \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 - \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e.             $('#inviteSend [name=email]').val(&quot;&quot;);             $('#sendInviteBtn').removeAttr(&quot;disabled&quot;);             bootbox.alert(&quot;\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 Email \u0440\u0430\u043d\u0435\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435!&quot;);         }     } });  Template.inviteList.events({     \/\/\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043b\u0438\u043a \u043f\u043e \u043a\u043d\u043e\u043f\u043a\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f     'click .deleteInviteBtn': function () {         \/\/\u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0442\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435         Meteor.call('deleteInvite', this._id, function (error, result) {             if (error) {                 bootbox.alert(&quot;\u041e\u0448\u0438\u0431\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u0432 \u0441\u043b\u0443\u0436\u0431\u0443 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438! \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438: &quot; + error.reason);             } else {                 bootbox.alert(&quot;\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u043e!&quot;);             }         });     } });  \/\/\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u0435\u043b\u043f\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441 \u043f\u0435\u0440\u0435\u0447\u043d\u0435\u043c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 Template.inviteList.helpers({     \/\/\u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0451\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439     invitedUsers: function () {         return Invite.find();     },     \/\/\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u0441\u0442\u0430\u0442\u0443\u0441\u044b \u0432 \u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e     inviteTextStatus: function() {         var textStatus = '-';         switch(this.status) {             case INVITE_CREATED:                 textStatus = '\u0441\u043e\u0437\u0434\u0430\u043d\u043e';                 break;             case INVITE_EMAILED:                 textStatus = '\u0432\u044b\u0441\u043b\u0430\u043d\u043e';                 break;             case INVITE_COMPLETED:                 textStatus = '\u043f\u0440\u0438\u043d\u044f\u0442\u043e';                 break;         }         return textStatus;     },     \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f     inviteIsComplete: function () {         if (this.status == INVITE_COMPLETED) {             return true;         } else {             return false;         }     },     \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f     inviteIsEmailed: function () {         if (this.status == INVITE_EMAILED) {             return true;         } else {             return false;         }     },     \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f     inviteIsCreated: function () {         if (this.status == INVITE_CREATED) {             return true;         } else {             return false;         }     } });  if (Meteor.isClient) {      \/\/\u041f\u043e\u0441\u043b\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438\u0437 \u0441\u0441\u044b\u043b\u043a\u0438, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0441\u0435\u0441\u0441\u0438\u044e \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438     Template.activateInviteToCompany.rendered = function () {         Session.set('activationToken', Router.current().params.activationToken);     };      \/\/\u0435\u0449\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0445\u0435\u043b\u043f\u0435\u0440\u043e\u0432     Template.activateInviteToCompany.helpers({         \/\/\u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0438\u043c\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u043a\u043e\u0434 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d         companyNameByInviteCode: function () {             var invite = Invite.findOne({token:Router.current().params.activationToken});             var company = Company.findOne({_id:invite.companyId});             return company.title;         },         \/\/\u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e \u043a\u043e\u0434\u0443 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d         companyUserNameByInviteCode: function () {             var invite = Invite.findOne({token:Router.current().params.activationToken});             var company = Company.findOne({_id:invite.companyId});             var user = Meteor.users.findOne({_id:company.userId});             return user.profile.name;         },         \/\/\u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043e\u0434 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d         userActivationCode: function () {             return Router.current().params.activationToken;         },         \/\/\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0435 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435         \/\/\u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c         inviteIsActivated: function () {             var userInviteCode = Router.current().params.activationToken;             var invite = Invite.findOne({token: userInviteCode});             if (invite.status == INVITE_COMPLETED) {                 return true;             } else {                 return false;             }         }     }); } <\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043c\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u044e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443. \u041f\u0440\u043e\u0439\u0434\u0451\u043c\u0441\u044f \u043f\u043e \u043d\u0435\u043c\u0443\u2026<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0438 \u00ab\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435\u00bb \u0438 \u00ab\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435\u00bb.<br \/>  \u041f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043d\u043e\u043f\u043a\u0438 \u00ab\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435\u00bb \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f email \u043d\u0430 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043b\u0438\u0431\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u043b\u0438\u0431\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u041f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043d\u043e\u043f\u043a\u0438 \u00ab\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435\u00bb \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f. \u0415\u0433\u043e \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0432\u044b\u0448\u0435.<\/p>\n<p>  \u0427\u0443\u0442\u044c \u043d\u0438\u0436\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0445\u0435\u043b\u043f\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u0430\u043d\u0435\u043b\u0438 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0412 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u0435\u043b\u043f\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0421\u0430\u043c\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u044d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 <b>Template.activateInviteToCompany.rendered<\/b>. \u0418\u043c\u0435\u043d\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441 \u043a\u043e\u0434\u043e\u043c \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438.<\/p>\n<h4>\u0416\u0438\u0432\u0430\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0439\u0442\u0438 \u043d\u0430 \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0438\u0437 \u043f\u0438\u0441\u044c\u043c\u0430, \u0432 \u0441\u0435\u0441\u0441\u0438\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u0435\u0433\u043e \u043a\u043e\u0434\u0435 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0442\u0437\u044b\u0432\u044b \u0438\u0437 Reformal \u0438 \u0435\u0441\u043b\u0438 \u0435\u043c\u0443 \u0441\u0442\u0430\u043d\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u2014 \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443 \u00ab\u0412\u043e\u0439\u0442\u0438 \/ \u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f\u00bb, \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0432\u043e\u0439\u0442\u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0430\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 (\u0433\u0440\u0443\u043f\u043f\u044b) \u0438 \u0441\u0440\u0430\u0437\u0443 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<p>  \u041b\u0438\u0431\u043e \u0436\u0435, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0439\u0442\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442. \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0442\u043e \u043e\u043d \u0445\u043e\u0440\u043e\u0448, \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e \u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u0442\u044c \u0441\u0432\u043e\u0438\u0445 \u043a\u043e\u043b\u043b\u0435\u0433 \u043a \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>  \u0412\u043e\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0432\u0441\u0451. \u0414\u0443\u043c\u0430\u044e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u043d\u0435 \u043f\u043b\u043e\u0445\u043e, \u0430 \u0432\u044b \u0447\u0442\u043e \u0441\u043a\u0430\u0436\u0435\u0442\u0435?<\/p>\n<p>  \u0416\u0438\u0432\u0443\u044e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/p.kellot.ru\/\">p.kellot.ru<\/a><br \/>  \u041f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u043c \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u043e\u0432 \u044f \u043d\u0435 \u0434\u0435\u043b\u0430\u043b, \u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043b \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0434 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u043a\u043e\u0434\u0430. \u0415\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0447\u0442\u043e \u043f\u043e\u0439\u0434\u0451\u0442 \u043d\u0435 \u0442\u0430\u043a \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0441 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u2014 \u043f\u0440\u043e\u0448\u0443 \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 <a href=\"http:\/\/p.kellot.ru\/reviews\">Reformal<\/a>.<\/p>\n<p>  <b>\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435<\/b>. \u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043d\u043e\u0432\u043e\u0433\u043e \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0430 \u2014 \u043e\u043d\u043b\u0430\u0439\u043d \u0442\u0430\u0431\u0435\u043b\u044f \u0443\u0447\u0451\u0442\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 <a href=\"http:\/\/kellot.ru\">Kellot.ru<\/a> \u0438 \u0434\u0435\u043b\u0430\u044e \u0432\u0441\u0451 \u044d\u0442\u043e \u0432 \u043e\u0434\u0438\u043d\u043e\u0447\u043a\u0443. \u0418 \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u0442\u044c \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0435\u0449\u0451 \u043f\u0430\u0440\u0443 \u0447\u0435\u043b\u043e\u0432\u0435\u043a.<\/p>\n<p>  \u041f\u043b\u0430\u043d\u044b \u043d\u0430 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0438 \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u0432 \u043e\u0434\u0438\u043d\u043e\u0447\u043a\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0451 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c, \u0430 \u0443\u0436\u0435 \u043f\u043e\u0440\u0430 \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u043f\u043b\u0430\u0442\u044b \u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0431\u0435\u0442\u0430-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/p>\n<p>  \u0422\u0430\u043a \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043f\u043e\u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u2014 \u0432\u0435\u043b\u043a\u0430\u043c \u0432 \u043b\u0438\u0447\u043a\u0443 \ud83d\ude09     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/257113\/\"> http:\/\/habrahabr.ru\/post\/257113\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u041f\u0440\u0438\u0432\u0435\u0442.<\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0443\u044e, \u043d\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 Email-\u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e Meteor \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u2014 \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u044e\u0434\u0435\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u043d\u0430\u0434 \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0443\u0447\u0435\u0431\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u044e\u0434\u0435\u0439 \u0438\u043b\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043f\u0440\u043e\u0434\u0443\u043a\u0446\u0438\u0438 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438.<\/p>\n<p>  \u0412 \u0441\u0435\u0442\u0438 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u0438 CoffeScript, \u043d\u043e \u043c\u043d\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0442\u0430\u043c \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438\u043d\u0432\u0430\u0439\u0442\u043e\u0432 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0435\u044e \u0441 \u0445\u0430\u0431\u0440\u0430\u0436\u0438\u0442\u0435\u043b\u044f\u043c\u0438.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043d\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0443\u043c\u0435\u0442\u044c:<br \/>  1) \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439 \u0438 \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u043e\u0432\u043e\u0433\u043e;<br \/>  2) \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445;<br \/>  3) \u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u043c\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0439;<br \/>  4) \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043d\u0430 email;<br \/>  5) \u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0440\u043e\u043b\u044f\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439;<br \/>  6) \u0410\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439;<br \/>  7) \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0443\u0447\u0443 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/p>\n<p>  <b>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435:<\/b> \u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0436\u0438\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043a \u0441\u0435\u0431\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f\u2026  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-256462","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/256462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=256462"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/256462\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=256462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=256462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=256462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}