"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7914],{27914:(L,i,a)=>{a.r(i),a.d(i,{SignupPage:()=>c,default:()=>M});var e=a(96540),u=a(49785),g=a(17172),l=a(88575),o=a(10354),P=a(67061),m=a(55852),t=a(2913),O=a(3169),f=a(35538),d=a(20851),E=a(78361);const c=({queryParams:_})=>{const D=(0,O._2)(),{handleSubmit:v,formState:{errors:r},register:s,getValues:C}=(0,u.mN)({defaultValues:{email:_.email,code:_.code}}),w=async n=>{n.name===""&&delete n.name,delete n.confirm,(await(0,g.AI)().post("/api/user/signup/step2",{email:n.email,code:n.code,username:n.email,orgName:n.orgName,password:n.password,name:n.name}).catch(p=>{const A=p.data?.message||p;D.warning(A)})).code==="redirect-to-select-org"&&window.location.assign((0,t.zj)().appSubUrl+"/profile/select-org?signup=1"),window.location.assign((0,t.zj)().appSubUrl+"/")};return e.createElement(d.GU,null,e.createElement(d.qm,null,e.createElement("form",{onSubmit:v(w),style:{width:"100%"}},e.createElement(l.D,{label:"Your name"},e.createElement(o.p,{id:"user-name",...s("name"),placeholder:"(optional)"})),e.createElement(l.D,{label:"Email",invalid:!!r.email,error:r.email?.message},e.createElement(o.p,{id:"email",...s("email",{required:"Email is required",pattern:{value:f.pL,message:"Email is invalid"}}),type:"email",placeholder:"Email"})),!(0,t.zj)().autoAssignOrg&&e.createElement(l.D,{label:"Org. name"},e.createElement(o.p,{id:"org-name",...s("orgName"),placeholder:"Org. name"})),(0,t.zj)().verifyEmailEnabled&&e.createElement(l.D,{label:"Email verification code (sent to your email)"},e.createElement(o.p,{id:"verification-code",...s("code"),placeholder:"Code"})),e.createElement(l.D,{label:"Password",invalid:!!r.password,error:r?.password?.message},e.createElement(E.s,{id:"new-password",autoFocus:!0,autoComplete:"new-password",...s("password",{required:"Password is required"})})),e.createElement(l.D,{label:"Confirm password",invalid:!!r.confirm,error:r?.confirm?.message},e.createElement(E.s,{id:"confirm-new-password",autoComplete:"new-password",...s("confirm",{required:"Confirmed password is required",validate:n=>n===C().password||"Passwords must match!"})})),e.createElement(P.B,null,e.createElement(m.$n,{type:"submit"},"Submit"),e.createElement(m.z9,{fill:"text",href:(0,t.zj)().appSubUrl+"/login"},"Back to login")))))},M=c}}]);

//# sourceMappingURL=7914.2b1a06c504df18e20fe4.js.map