(window.webpackJsonp=window.webpackJsonp||[]).push([[37],{mwzk:function(e,r,t){"use strict";t.r(r),t.d(r,"SignupInvitedPage",(function(){return h}));var n=t("q1tI"),a=t.n(n),i=t("/MKj"),o=t("t8hP"),l=t("kDLi"),c=t("Y8YH"),u=t("ZGyg"),s=t("HJRA"),m=t("ZFWI");function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function d(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){f(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function f(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function b(e,r,t,n,a,i,o){try{var l=e[i](o),c=l.value}catch(e){return void t(e)}l.done?r(c):Promise.resolve(c).then(n,a)}function v(e){return function(){var r=this,t=arguments;return new Promise((function(n,a){var i=e.apply(r,t);function o(e){b(i,n,a,o,l,"next",e)}function l(e){b(i,n,a,o,l,"throw",e)}o(void 0)}))}}function g(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if(!(Symbol.iterator in Object(e))&&"[object Arguments]"!==Object.prototype.toString.call(e))return;var t=[],n=!0,a=!1,i=void 0;try{for(var o,l=e[Symbol.iterator]();!(n=(o=l.next()).done)&&(t.push(o.value),!r||t.length!==r);n=!0);}catch(e){a=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(a)throw i}}return t}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var w={main:{icon:"grafana",text:"Invite",subTitle:"Register your Grafana account",breadcrumbs:[{title:"Login",url:"login"}]},node:{text:""}},h=function(){var e=Object(i.useSelector)((function(e){return e.location.routeParams.code})),r=g(Object(n.useState)(),2),t=r[0],p=r[1],f=g(Object(n.useState)(),2),b=f[0],h=f[1],y=g(Object(n.useState)(),2),O=y[0],j=y[1];Object(c.a)(v(regeneratorRuntime.mark((function r(){var t;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Object(o.getBackendSrv)().get("/api/user/invite/".concat(e));case 2:t=r.sent,p({email:t.email,name:t.name,username:t.email}),h(t.name||t.email||t.username),j(t.invitedBy);case 6:case"end":return r.stop()}}),r)}))),[e]);var E=function(){var r=v(regeneratorRuntime.mark((function r(t){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Object(o.getBackendSrv)().post("/api/user/invite/complete",d({},t,{inviteCode:e}));case 2:window.location.href=Object(m.c)().appSubUrl+"/";case 3:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}();return t?a.a.createElement(u.a,{navModel:w},a.a.createElement(u.a.Contents,null,a.a.createElement("h3",{className:"page-sub-heading"},"Hello ",b||"there","."),a.a.createElement("div",{className:"modal-tagline p-b-2"},a.a.createElement("em",null,O||"Someone")," has invited you to join Grafana and the organization"," ",a.a.createElement("span",{className:"highlight-word"},s.b.user.orgName),a.a.createElement("br",null),"Please complete the following and choose a password to accept your invitation and continue:"),a.a.createElement(l.Form,{defaultValues:t,onSubmit:E},(function(e){var r=e.register,t=e.errors;return a.a.createElement(a.a.Fragment,null,a.a.createElement(l.Field,{invalid:!!t.email,error:t.email&&t.email.message,label:"Email"},a.a.createElement(l.Input,{placeholder:"email@example.com",name:"email",ref:r({required:"Email is required",pattern:{value:/^\S+@\S+$/,message:"Email is invalid"}})})),a.a.createElement(l.Field,{invalid:!!t.name,error:t.name&&t.name.message,label:"Name"},a.a.createElement(l.Input,{placeholder:"Name (optional)",name:"name",ref:r})),a.a.createElement(l.Field,{invalid:!!t.username,error:t.username&&t.username.message,label:"Username"},a.a.createElement(l.Input,{placeholder:"Username",name:"username",ref:r({required:"Username is required"})})),a.a.createElement(l.Field,{invalid:!!t.password,error:t.password&&t.password.message,label:"Password"},a.a.createElement(l.Input,{type:"password",placeholder:"Password",name:"password",ref:r({required:"Password is required"})})),a.a.createElement(l.Button,{type:"submit"},"Sign Up"))})))):null};r.default=h}}]);
//# sourceMappingURL=SignupInvited.4cef41c9baecdb31736b.js.map