"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7429],{62887:(U,s,n)=>{n.r(s),n.d(s,{SignupInvitedPage:()=>r,default:()=>M});var e=n(68404),c=n(22350),o=n(54899),u=n(94270),l=n(24799),i=n(46967),_=n(31403),E=n(79396),g=n(47694),P=n(77582),v=n(77293);const p={main:{icon:"grafana",text:"Invite",subTitle:"Register your Grafana account",breadcrumbs:[{title:"Login",url:"login"}]},node:{text:""}},r=({match:D})=>{const m=D.params.code,[d,O]=(0,e.useState)(),[I,f]=(0,e.useState)(),[h,C]=(0,e.useState)();(0,c.Z)(async()=>{const a=await(0,o.i)().get(`/api/user/invite/${m}`);O({email:a.email,name:a.name,username:a.email}),f(a.name||a.email||a.username),C(a.invitedBy)},[m]);const T=async a=>{await(0,o.i)().post("/api/user/invite/complete",{...a,inviteCode:m}),window.location.href=(0,g.iE)().appSubUrl+"/"};return d?e.createElement(E.T,{navModel:p},e.createElement(E.T.Contents,null,e.createElement("h3",{className:"page-sub-heading"},"Hello ",I||"there","."),e.createElement("div",{className:"modal-tagline p-b-2"},e.createElement("em",null,h||"Someone")," has invited you to join Grafana and the organization"," ",e.createElement("span",{className:"highlight-word"},P.Vt.user.orgName),e.createElement("br",null),"Please complete the following and choose a password to accept your invitation and continue:"),e.createElement(u.l,{defaultValues:d,onSubmit:T},({register:a,errors:t})=>e.createElement(e.Fragment,null,e.createElement(l.g,{invalid:!!t.email,error:t.email&&t.email.message,label:"Email"},e.createElement(i.I,{placeholder:"email@example.com",...a("email",{required:"Email is required",pattern:{value:v.Yb,message:"Email is invalid"}})})),e.createElement(l.g,{invalid:!!t.name,error:t.name&&t.name.message,label:"Name"},e.createElement(i.I,{placeholder:"Name (optional)",...a("name")})),e.createElement(l.g,{invalid:!!t.username,error:t.username&&t.username.message,label:"Username"},e.createElement(i.I,{...a("username",{required:"Username is required"}),placeholder:"Username"})),e.createElement(l.g,{invalid:!!t.password,error:t.password&&t.password.message,label:"Password"},e.createElement(i.I,{...a("password",{required:"Password is required"}),type:"password",placeholder:"Password"})),e.createElement(_.zx,{type:"submit"},"Sign up"))))):null},M=r}}]);

//# sourceMappingURL=SignupInvited.6fb16f38d7262db2aadf.js.map