"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7909],{97909:(L,m,n)=>{n.r(m),n.d(m,{SignupPage:()=>_,default:()=>f});var e=n(27702),g=n(73289),p=n(23839),i=n(22209),s=n(1128),P=n(64022),r=n(66670),t=n(12308),O=n(73807),M=n(41715),d=n(8874),c=n(77597);const _=u=>{const v=(0,O.iG)(),C=async a=>{a.name===""&&delete a.name,delete a.confirm,(await(0,g.i)().post("/api/user/signup/step2",{email:a.email,code:a.code,username:a.email,orgName:a.orgName,password:a.password,name:a.name}).catch(o=>{const E=o.data?.message||o;v.warning(E)})).code==="redirect-to-select-org"&&window.location.assign((0,t.iE)().appSubUrl+"/profile/select-org?signup=1"),window.location.assign((0,t.iE)().appSubUrl+"/")},D={email:u.queryParams.email,code:u.queryParams.code};return e.createElement(d.dd,null,e.createElement(d.$s,null,e.createElement(p.l,{defaultValues:D,onSubmit:C},({errors:a,register:l,getValues:o})=>e.createElement(e.Fragment,null,e.createElement(i.g,{label:"Your name"},e.createElement(s.I,{id:"user-name",...l("name"),placeholder:"(optional)"})),e.createElement(i.g,{label:"Email",invalid:!!a.email,error:a.email?.message},e.createElement(s.I,{id:"email",...l("email",{required:"Email is required",pattern:{value:M.Yb,message:"Email is invalid"}}),type:"email",placeholder:"Email"})),!(0,t.iE)().autoAssignOrg&&e.createElement(i.g,{label:"Org. name"},e.createElement(s.I,{id:"org-name",...l("orgName"),placeholder:"Org. name"})),(0,t.iE)().verifyEmailEnabled&&e.createElement(i.g,{label:"Email verification code (sent to your email)"},e.createElement(s.I,{id:"verification-code",...l("code"),placeholder:"Code"})),e.createElement(i.g,{label:"Password",invalid:!!a.password,error:a?.password?.message},e.createElement(c.Z,{id:"new-password",autoFocus:!0,autoComplete:"new-password",...l("password",{required:"Password is required"})})),e.createElement(i.g,{label:"Confirm password",invalid:!!a.confirm,error:a?.confirm?.message},e.createElement(c.Z,{id:"confirm-new-password",autoComplete:"new-password",...l("confirm",{required:"Confirmed password is required",validate:E=>E===o().password||"Passwords must match!"})})),e.createElement(P.Lh,null,e.createElement(r.zx,{type:"submit"},"Submit"),e.createElement(r.Qj,{fill:"text",href:(0,t.iE)().appSubUrl+"/login"},"Back to login"))))))},f=_}}]);

//# sourceMappingURL=7909.edb1a5ec4c988e05ee52.js.map