1"use strict";(self.webpackChunkreact_saas_template=self.webpackChunkreact_saas_template||[]).push([[7412],{27412:(e,a,r)=>{r.r(a),r.d(a,{default:()=>j});var t=r(65043),o=r(96446),s=r(67784),n=r(74605),l=r(51962),i=r(85865),u=r(81673),c=r(11906),d=r(57256),p=(r(92888),r(27752)),h=r(30247),m=r(86347),f=r(97508),g=r(40854),v=r.n(g),x=r(84717),w=r(87070),y=r(16928),b=r(82024),C=r(93222),R=r(70579);const k=r(67504);const j=(0,C.withRouter)((0,d.A)((e=>({wrapper:{padding:"2rem"},link:{transition:e.transitions.create(["background-color"],{duration:e.transitions.duration.complex,easing:e.transitions.easing.easeInOut}),cursor:"pointer",color:e.palette.primary.main,"&:enabled:hover":{color:e.palette.primary.dark},"&:enabled:focus":{color:e.palette.primary.dark}},container:{maxWidth:"500px",margin:"auto"},flex:{display:"flex",gap:e.spacing(2)}})),{withTheme:!0})((function(e){const a=(0,f.wA)(),{setStatus:r,theme:d,onClose:g,history:C,openTermsDialog:j,status:A,classes:T}=e,[S,D]=(0,t.useState)(!1),[W,F]=(0,t.useState)(!1),[M,_]=(0,t.useState)(!1),[q,I]=(0,t.useState)(!1),N=(0,t.useRef)(),P=(0,t.useRef)(),V=(0,t.useRef)(),H=(0,t.useRef)(),E=(0,t.useRef)(),Y=(0,t.useRef)(),z=(0,t.useRef)(),K=(0,t.useRef)(),L=(0,t.useRef)(),O=(0,t.useRef)(),B=(0,f.d4)((e=>e.login.isAuthenticated));return(0,t.useEffect)((()=>{B&&(window.location.href="/c/profile-completion")})),(0,t.useCallback)((()=>{if(!N.current.checked)return void F(!0);if(L.current.value!==O.current.value)return void r("passwordsDontMatch");let e={first_name:P.current.value,last_name:V.current.value,email:H.current.value,password:L.current.value,school:E.current.value,hear:Y.current.value,confidence:z.current.value,question:K.current.value};D(!0),v().post("api/users/register",e).then((e=>{const{token:t}=e.data;localStorage.setItem("jwtToken",t),(0,x.A)(t);const o=(0,w.default)(t);k(o)||(r(null),console.log(o),a((0,y._3)(!0)),a((0,b.lt)(o)),D(!1),localStorage.setItem("hasRegistered",!0))})).catch((e=>{var a,r,t,o,s;(null!==(a=e.response)&&void 0!==a&&null!==(r=a.data)&&void 0!==r&&null!==(t=r.error)&&void 0!==t&&t.includes("already exists")||null!==(o=e.response)&&void 0!==o&&null!==(s=o.data)&&void 0!==s&&s.emailTaken)&&I(!0),D(!1)}))}),[D,r,F,L,O,N,a]),(0,R.jsx)(o.A,{className:T.wrapper,children:(0,R.jsx)(o.A,{className:T.container,children:(0,R.jsxs)("form",{action:"",children:[(0,R.jsxs)("div",{className:T.flex,children:[(0,R.jsx)(s.A,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,label:"First Name",inputRef:P,autoFocus:!0,autoComplete:"off",type:"text"}),(0,R.jsx)(s.A,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,label:"Last Name",inputRef:V,autoFocus:!0,autoComplete:"off",type:"text"})]}),(0,R.jsx)(s.A,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,error:q,label:"Email Address",inputRef:H,autoFocus:!0,autoComplete:"off",type:"email",onChange:()=>{q&&r(null)},FormHelperTextProps:{error:!0},helperText:q?(0,R.jsx)("span",{children:"Sorry that email is already being used by another account"}):""}),(0,R.jsx)(m.A,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,error:"passwordTooShort"===A||"passwordsDontMatch"===A,label:"Password",inputRef:L,autoComplete:"off",onChange:()=>{"passwordTooShort"!==A&&"passwordsDontMatch"!==A||r(null)},helperText:"passwordTooShort"===A?"Create a password at least 6 characters long.":"passwordsDontMatch"===A?"Your passwords dont match.":null,FormHelperTextProps:{error:!0},isVisible:M,onVisibilityChange:_}),(0,R.jsx)(m.A,{variant:"outlined",margin:"normal",required:!0,fullWidth:!0,error:"passwordTooShort"===A||"passwordsDontMatch"===A,label:"Repeat Password",inputRef:O,autoComplete:"off",onChange:()=>{"passwordTooShort"!==A&&"passwordsDontMatch"!==A||r(null)},helperText:"passwordTooShort"===A?"Create a password at least 6 characters long.":"passwordsDontMatch"===A?"Your passwords dont match.":void 0,FormHelperTextProps:{error:!0},isVisible:M,onVisibilityChange:_}),(0,R.jsx)(n.A,{style:{marginRight:0},control:(0,R.jsx)(l.A,{color:"primary",inputRef:N,onChange:()=>{F(!1)}}),label:(0,R.jsxs)(i.A,{variant:"body1",children:["I agree to the",(0,R.jsxs)("span",{className:T.link,onClick:S?null:j,tabIndex:0,role:"button",onKeyDown:e=>{(!S&&13===e.keyCode||32===e.keyCode)&&j()},children:[" ","terms of service"]})]})}),W&&(0,R.jsx)(u.A,{error:!0,style:{display:"block",marginTop:d.spacing(-1)},children:"In order to create an account, you have to accept our terms of service."}),"accountCreated"===A?(0,R.jsx)(p.A,{children:"We have created your account. Please click on the link in the email we have sent to you before logging in."}):null,(0,R.jsxs)(c.A,{type:"submit",fullWidth:!0,variant:"contained",size:"large",color:"secondary",disabled:S,children:["Register",S&&
1(0,R.jsx)(h.A,{})]})]})})})})))}}]); 2//# sourceMappingURL=7412.4f23ced6.chunk.js.map
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.