"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[3392],{43392:(e,a,i)=>{i.r(a),i.d(a,{SignupPage:()=>w,default:()=>j});i(68404);var s,r=i(6932),l=i(61692),n=i(84719),o=i(1652),d=i(25049),t=i(40920),c=i(78837),m=i(58257),u=i(85040),g=i(45653),p=i(45916);const w=e=>{const a=(0,m.iG)(),i={email:e.queryParams.email,code:e.queryParams.code};return(0,p.jsx)(u.dd,{children:(0,p.jsx)(u.$s,{children:(0,p.jsx)(l.l,{defaultValues:i,onSubmit:async e=>{""===e.name&&delete e.name,delete e.confirm;"redirect-to-select-org"===(await(0,r.i)().post("/api/user/signup/step2",{email:e.email,code:e.code,username:e.email,orgName:e.orgName,password:e.password,name:e.name}).catch((e=>{var i;const s=(null===(i=e.data)||void 0===i?void 0:i.message)||e;a.warning(s)}))).code&&window.location.assign((0,c.iE)().appSubUrl+"/profile/select-org?signup=1"),window.location.assign((0,c.iE)().appSubUrl+"/")},children:e=>{var a,i,r;let{errors:l,register:m,getValues:u}=e;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.g,{label:"Your name",children:(0,p.jsx)(o.I,Object.assign({id:"user-name"},m("name"),{placeholder:"(optional)"}))}),(0,p.jsx)(n.g,{label:"Email",invalid:!!l.email,error:null===(a=l.email)||void 0===a?void 0:a.message,children:(0,p.jsx)(o.I,Object.assign({id:"email"},m("email",{required:"Email is required",pattern:{value:/^\S+@\S+$/,message:"Email is invalid"}}),{type:"email",placeholder:"Email"}))}),!(0,c.iE)().autoAssignOrg&&(0,p.jsx)(n.g,{label:"Org. name",children:(0,p.jsx)(o.I,Object.assign({id:"org-name"},m("orgName"),{placeholder:"Org. name"}))}),(0,c.iE)().verifyEmailEnabled&&(0,p.jsx)(n.g,{label:"Email verification code (sent to your email)",children:(0,p.jsx)(o.I,Object.assign({id:"verification-code"},m("code"),{placeholder:"Code"}))}),(0,p.jsx)(n.g,{label:"Password",invalid:!!l.password,error:null==l||null===(i=l.password)||void 0===i?void 0:i.message,children:(0,p.jsx)(g.Z,Object.assign({id:"new-password",autoFocus:!0,autoComplete:"new-password"},m("password",{required:"Password is required"})))}),(0,p.jsx)(n.g,{label:"Confirm password",invalid:!!l.confirm,error:null==l||null===(r=l.confirm)||void 0===r?void 0:r.message,children:(0,p.jsx)(g.Z,Object.assign({id:"confirm-new-password",autoComplete:"new-password"},m("confirm",{required:"Confirmed password is required",validate:e=>e===u().password||"Passwords must match!"})))}),(0,p.jsxs)(d.Lh,{children:[s||(s=(0,p.jsx)(t.zx,{type:"submit",children:"Submit"})),(0,p.jsx)(t.Qj,{fill:"text",href:(0,c.iE)().appSubUrl+"/login",children:"Back to login"})]})]})}})})})},j=w}}]);
//# sourceMappingURL=3392.eeedb8ea8278225ef141.js.map