"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7429],{16067:(U,s,n)=>{n.r(s),n.d(s,{SignupInvitedPage:()=>r,default:()=>M});var e=n(39953),c=n(20653),o=n(4148),u=n(85830),l=n(96227),i=n(38637),_=n(4919),E=n(13253),g=n(50820),P=n(21308),v=n(22001);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.3d73534a8b3fdfe44c7b.js.map