1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[511],{6998:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/recovery/[otp]",function(){return t(72089)}])},72089:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return T}});var i=t(85893),r=t(24062),l=t(67294),s=t(65449),o=t(32572),a=t(71703),c=t(11163),d=t(39550),u=t(22318),p=t(9921),h=t(46277),m=t(11774),f=t(92142),x=t(55643),y=t(39752),g=t(42283),j=t(10858),v=t(57343),Z=t(54035),w=t(20595),C=t(98406),b=t(81160),_=e=>{var n;let{state:t,availableActions:r,validateForm:a,postValidationAction:c,expectedKeys:d}=e,{errorMsg:u,setErrorMsg:h,setThinking:m}=(0,l.useContext)(o.St),{isMobile:f,isTablet:x}=(0,l.useContext)(o.Ly),{register:_,handleSubmit:N,errors:T,setError:k,clearErrors:E}=(0,g.cI)({mode:"onSubmit",reValidateMode:"onChange",defaultValues:t,resolver:void 0,context:void 0,criteriaMode:"all",shouldFocusError:!0,shouldUnregister:!0}),P=async e=>{try{m(1);let{username:n}=t,{mainWallet:i}=(0,C._)(n,null==e?void 0:e.mnemonic),r=null==i?void 0:i.pubPKI,{match:l}=await (0,p.f4)("/api/internal/user/check24",{username:n,pki:r});if(l)return a(e,d,c);h("Mnemonic doesn't match username")}catch(e){console.log({error:e})}finally{m(0)}};return(0,i.jsx)(s.Z,{p:0,width:"100%",minHeight:"420px",display:"flex",alignItems:"center",justifyContent:"center",children:(0,i.jsx)("form",{onSubmit:N(P),style:{width:"inherit"},children:(0,i.jsxs)(Z.Z,{justify:"center",children:[!f&&(0,i.jsx)(w.Z,{span:x?2:3}),(0,i.jsxs)(w.Z,{span:f?12:x?8:6,children:[(0,i.jsx)(s.Z,{display:"flex",justifyContent:"center",children:(0,i.jsx)(b.D,{color:"error",children:u})}),(0,i.jsx)(s.Z,{paddingTop:2,paddingBottom:2,paddingLeft:0,paddingRight:0,children:(0,i.jsx)(v.Z,{itype:y.Je.ROUNDEDSTRING,autoComplete:"no",name:"mnemonic",label:"Mnemonic",placeholder:"Enter your mnemonic 24 words",fullWidth:!0,error:!!(null==T?void 0:T.mnemonic),onChange:()=>{E(),h("")},helperText:null==T?void 0:null===(n=T.mnemonic)||void 0===n?void 0:n.message,inputRef:_({required:"Mnemonic is required"}),inputProps:{"data-cy":"lastName"},InputLabelProps:{shrink:!0}})})]}),!f&&(0,i.jsx)(w.Z,{span:x?2:3}),!f&&(0,i.jsx)(w.Z,{span:x?2:3}),(0,i.jsx)(w.Z,{span:f?12:x?8:6,children:(0,i.jsx)(j.Z,{actions:r,errors:!!(null==T?void 0:T.firstName)||!!(null==T?void 0:T.lastName)})}),!f&&(0,i.jsx)(w.Z,{span:x?2:3})]})})})},N=t(11399),T=()=>{let{query:e}=(0,c.useRouter)(),{otp:n}=e,[t,g]=(0,d.Z)({}),{user:j,navigateTo:v,setThinking:Z,loading:w,errorMsg:C,setErrorMsg:b}=(0,l.useContext)(o.St);(0,l.useEffect)(()=>{(null==j?void 0:j.username)&&v("/")},[j,v]);let T=async e=>{},k=[{title:"Name",panel:_,expectedKeys:["firstName","lastName"]},{title:"Password",panel:h.Z,expectedKeys:["username"],recovery:!0},{title:"Recovery",panel:m.Z},{title:"Done",panel:f.Z}],E=(0,l.useCallback)(async()=>{try{if(!n)return b("This magic link in invalid, please try to register again, and contact support if the problem continues.");b(void 0),Z(1);let e=await (0,p.f4)("/api/internal/email/verifyOTP/"+n+"/recovery");return(null==e?void 0:e.valid)&&(null==e?void 0:e.username)?g(t=>({...t,otp:n,username:null==e?void 0:e.username})):b("This magic link in invalid, please try to register again, and contact support if the problem continues."),e}catch(e){console.log(e),b("There has been an error during registration, please contact [email protected]")}finally{Z(0)}},[n]);return(0,l.useEffect)(()=>{E&&E().then(console.log)},[E]),(0,i.jsx)(r.Z,{align:"center",details:{title:"UltraMega"},children:(null==t?void 0:t.otp)?(0,i.jsx)(x.Z,{steps:k,state:t,setState:g,finalFormSubmit:T,formCompleteAction:()=>{},iconType:"number",displayPanelsOnTop:!1,showDoneButton:!1,showLabels:!0,alignItems:"center",justifyContent:"center",actionsLayout:y._H.onboarding,showTopBackButton:!0}):w?(0,i.jsx)(s.Z,{display:"flex",width:"100%",justifyContent:"center",children:(0,i.jsx)(a.Z,{height:"30vh"})}):(0,i.jsx)(s.Z,{width:"50%",mx:"25%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",children:C?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.Z,{p:3,flexBasis:"30%",children:(0,i.jsx)(u.Z,{variant:"h6",color:"error",children:C})}),(0,i.jsx)(s.Z,{children:(0,i.jsx)(N.Z,{style:y.UH.roundedOutlinedSecondary,onClick:()=>v("/"),children:"Sign up"})})]}):(0,i.jsx)(s.Z,{p:3,flexBasis:"50%",mx:"25%",textAlign:"center",children:(0,i.jsx)(u.Z,{variant:"h6",children:"Verifying OTP"})})})})}}},function(e){e.O(0,[272,700,230,37,221,622,367,62,634,608,774,888,179],function(){return e(e.s=6998)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.