PageSourceSearch

https://app.useavaila.com/_next/static/chunks/pages/login-86dfb60bbeb1a918.js

js useavaila.com collected 2026-10-02 01:47:48 UTC 18,462 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[459],{545:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/login",function(){return s(3946)}])},2296:function(e,t,s){"use strict";let i;s.d(t,{Ap:function(){return u},I8:function(){return c},co:function(){return h},db:function(){return d}});var r=s(3977),a=s(1259),o=s(9828),n=s(7004),l=s(8887);(0,r.C6)().length<1&&(i=(0,r.ZF)({apiKey:"AIzaSyCPH8b8wnurwPHZAb0eyufqXfyaenl7xY4",authDomain:"availa-388217.firebaseapp.com",projectId:"availa-388217",storageBucket:"availa-388217.appspot.com",messagingSenderId:"100258821001",appId:"1:100258821001:web:5f187142d930e1db0f2758",measurementId:"G-1GKLFVCRYW"}));let h=(0,l.IH)(i),d=(0,o.ad)(i),c=(0,a.v0)(i),u=new a.hJ;(0,n.$C)(i)},3946:function(e,t,s){"use strict";s.r(t);var i=s(5893),r=s(7294),a=s(9008),o=s.n(a),n=s(1664),l=s.n(n),h=s(1163),d=s.n(h),c=s(8529),u=s.n(c),g=s(8966),p=s.n(g),m=s(3440),x=s(204),w=s(3143),b=s(4418),j=s(3100),f=s(654),y=s(6177),S=s(4093),v=s(3863),_=s(3775),C=s(9222),k=s(8911),I=s(7484),P=s(75),N=s(2296),L=s(8887),U=s(1259),A=s(9828),E=s(3299);class K extends r.Component{componentDidMount(){let{data:e}=this.props.session,t=!1;var s=(0,U.Aj)(N.I8,(function(i){if(i&&!this.state.loggingIn&&!t)return d().push("/account");if(t=!0,e){let t=U.hJ.credential(e.id_token,e.accessToken);this.setState({loggingIn:!0}),(0,U.sB)(N.I8,t).then((function(){this.setState({loggingIn:!1});let t=(0,A.IO)((0,A.hJ)(N.db,"users"),(0,A.ar)("email","==",e.user.email.trim()));(0,A.PL)(t).then((function(t){t.empty?((0,U.ck)(N.I8.currentUser,{displayName:""}),(0,L.Kz)(N.co,"sign_up",{method:"Google",email:e.user.email.trim()}),this.setState({loading:!1,newProvider:!0,email:e.user.email,errorStatus:""})):((0,L.Kz)(N.co,"login",{method:"Google",email:e.user.email.trim()}),t.forEach(e=>{let t=(0,A.JU)(N.db,"users",e.data().username.trim());(0,A.r7)(t,{provider:!0}).then((function(){(0,U.ck)(N.I8.currentUser,{displayName:e.data().username.trim()}).then((function(){this.props.router.query.redir?d().push(decodeURIComponent(this.props.router.query.redir)):d().push("/")}).bind(this))}).bind(this))}))}).bind(this))}).bind(this)).catch((function(e){console.error(e)}).bind(this))}else this.setState({loading:!1}),s()}).bind(this))}render(){return this.state.forgotPassword?(0,i.jsxs)("div",{children:[(0,i.jsx)(o(),{children:(0,i.jsx)("title",{children:"Login"})}),(0,i.jsx)("div",{style:{cursor:"pointer",width:"20px",position:"absolute",left:"1%"},children:(0,i.jsx)(l(),{href:"/",children:(0,i.jsx)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",paddingTop:"10px"},children:(0,i.jsx)(m.Z,{style:{color:"white",width:"30px",height:"30px"}})})})}),(0,i.jsx)(x.k,{minH:"100vh",align:"center",justify:"center",bg:"black",children:(0,i.jsxs)(w.K,{spacing:4,w:"full",maxW:"md",bg:"gray.800",rounded:"xl",boxShadow:"lg",p:6,my:12,children:[(0,i.jsx)("a",{className:"text-blue-500 cursor-pointer hover:underline",onClick:()=>{this.setState({forgotPassword:!1,errorStatus:"",email:""})},children:"Back"}),(0,i.jsx)(b.X,{lineHeight:1.1,color:"white",fontSize:{base:"2xl",md:"3xl"},children:"Forgot your password?"}),(0,i.jsx)(k.x,{fontSize:{base:"sm",sm:"md"},color:"white",children:"You'll get an email with a reset link"}),(0,i.jsxs)(f.NI,{id:"email",children:[(0,i.jsx)(y.l,{color:"white",children:"Email"}),(0,i.jsx)(S.I,{color:"white",onChange:this.handleChange,placeholder:"[email protected]",_placeholder:{color:"gray.500"},type:"email",name:"email"})]}),(0,i.jsx)(w.K,{spacing:6,children:(0,i.jsx)(C.z,{isLoading:this.state.loading,onClick:this.handleForgotPassword,bg:"blue.400",color:"white",_hover:{bg:"blue.500"},disabled:!this.state.email,children:"Request Reset"})}),(0,i.jsx)("p",{className:"text-red-600 text-center",children:this.state.errorStatus})]})})]}):this.state.newProvider?(0,i.jsxs)("div",{children:[(0,i.jsx)(o(),{children:(0,i.jsx)("title",{children:"Login"})}),(0,i.jsx)("div",{style:{cursor:"pointer",width:"20px",position:"absolute",left:"1%"},children:(0,i.jsx)(l(),{href:"/",children:(0,i.jsx)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",paddingTop:"10px"},children:(0,i.jsx)(m.Z,{style:{color:"white",width:"30px",height:"30px"}})})})}),(0,i.jsx)(x.k,{minH:"100vh",align:"center",justify:"center",bg:"black",children:(0,i.jsxs)(w.K,{spacing:5,w:"full",maxW:"md",bg:"gray.800",rounded:"xl",boxShadow:"lg",p:6,my:12,children:[(0,i.jsx)(b.X,{lineHeight:1.1,color:"white",fontSize:{base:"2xl",md:"3xl"},children:"Create Account"}),(0,i.jsxs)(f.NI,{id:"firstName",my:3,children:[(0,i.jsx)(y.l,{color:"white",children:"First Name"}
1),(0,i.jsx)(S.I,{color:"white",onChange:this.handleChange,_placeholder:{color:"gray.500"},type:"email",name:"firstName"})]}),(0,i.jsxs)(f.NI,{id:"lastName",my:3,children:[(0,i.jsx)(y.l,{color:"white",children:"Last Name"}),(0,i.jsx)(S.I,{color:"white",onChange:this.handleChange,_placeholder:{color:"gray.500"},type:"text",name:"lastName"})]}),(0,i.jsxs)(f.NI,{id:"username",my:3,children:[(0,i.jsx)(y.l,{color:"white",children:"Create a Peak Username"}),(0,i.jsx)(S.I,{color:"white",onChange:this.handleChange,_placeholder:{color:"gray.500"},type:"text",name:"username",maxLength:"15"})]}),(0,i.jsx)(w.K,{spacing:6,children:(0,i.jsx)(C.z,{isLoading:this.state.loading,onClick:this.handleNewProvider,bg:"blue.400",color:"white",_hover:{bg:"blue.500"},disabled:!this.state.username||!this.state.firstName||!this.state.lastName,children:"Continue"})}),(0,i.jsx)("p",{className:"text-red-600 text-center",children:this.state.errorStatus})]})})]}):this.state.alreadyProvider?(0,i.jsxs)("div",{children:[(0,i.jsx)(o(),{children:(0,i.jsx)("title",{children:"Login"})}),(0,i.jsx)("div",{style:{cursor:"pointer",width:"20px",position:"absolute",left:"1%"},children:(0,i.jsx)(l(),{href:"/",children:(0,i.jsx)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",paddingTop:"10px"},children:(0,i.jsx)(m.Z,{style:{color:"white",width:"30px",height:"30px"}})})})}),(0,i.jsx)(x.k,{minH:"100vh",align:"center",justify:"center",bg:"black",children:(0,i.jsxs)(w.K,{spacing:4,w:"full",maxW:"md",bg:"gray.800",rounded:"xl",boxShadow:"lg",p:6,my:12,children:[this.state.submitLink&&(0,i.jsx)("a",{className:"text-blue-500 cursor-pointer hover:underline",onClick:()=>{this.setState({submitLink:!1,errorStatus:"",email:""})},children:"Back"}),(0,i.jsx)(b.X,{lineHeight:1.1,color:"white",fontSize:{base:"2xl",md:"3xl"},children:"Google Account Already Exists"}),(0,i.jsxs)(k.x,{fontSize:{base:"sm",sm:"md"},color:"white",children:[this.state.submitLink?"Create a password to link to your Peak account":"You can log in with your Google account, or create a\n                            password to be able to log in with an email and\n                            password as well."," "]}),!this.state.submitLink&&(0,i.jsxs)(w.K,{spacing:6,children:[(0,i.jsx)(C.z,{onClick:this.handleGoogleLogin,bg:"blue.400",color:"white",_hover:{bg:"blue.500"},children:"Login with Google"}),(0,i.jsx)(C.z,{onClick:()=>{this.setState({submitLink:!this.state.submitLink})},bg:"blue.400",color:"white",_hover:{bg:"blue.500"},children:"Create Password"})]}),this.state.submitLink&&(0,i.jsxs)(w.K,{spacing:4,children:[(0,i.jsxs)(f.NI,{id:"email",children:[(0,i.jsx)(y.l,{color:"white",children:"Password"}),(0,i.jsx)(S.I,{color:"white",type:"password",name:"password",onChange:this.handleChange})]}),(0,i.jsx)(C.z,{isLoading:this.state.loading,bg:"blue.400",color:"white",_hover:{bg:"blue.500"},onClick:this.linkProvider,disabled:!this.state.password,children:"Create"})]}),(0,i.jsx)("p",{className:"text-red-600 text-center",children:this.state.errorStatus})]})})]}):(0,i.jsxs)("div",{children:[(0,i.jsx)(o(),{children:(0,i.jsx)("title",{children:"Login"})}),(0,i.jsx)("div",{style:{cursor:"pointer",width:"20px",position:"absolute",left:"1%"},children:(0,i.jsx)(l(),{href:"/",children:(0,i.jsx)("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",paddingTop:"10px"},children:(0,i.jsx)(m.Z,{style:{color:"white",width:"30px",height:"30px"}})})})}),(0,i.jsx)(x.k,{minH:"100vh",align:"center",justify:"center",bg:"black",children:(0,i.jsxs)(w.K,{spacing:8,w:{base:"full",md:"xl"},py:12,px:6,children:[(0,i.jsx)(w.K,{align:"center",children:(0,i.jsx)(b.X,{color:"white",fontSize:{base:"3xl",md:"4xl"},children:"Sign in to your account"})}),(0,i.jsx)(j.xu,{rounded:"xl",bg:"gray.800",boxShadow:"lg",p:8,w:"full",children:(0,i.jsxs)(w.K,{spacing:4,children:[(0,i.jsxs)("button",{className:"w-auto mb-3 relative inline-flex items-center text-center rounded-lg bg-white leading-tight h-10 font-bold",value:"googleLogin",onClick:this.handleGoogleLogin,children:[(0,i.jsx)("span",{className:u().iconSpan,children:(0,i.jsxs)("svg",{width:"25",height:"25",viewBox:"0 0 256 262",xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid",children:[(0,i.jsx)("path",{d:"M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027",fill:"#4285F4"}),(0,i.jsx)("path",{d:"M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1",fill:"#34A853"}),(0,i.jsx)("path",{d:"M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782",fill:"#FBBC05"}),(0,i.jsx)("path",{d:"M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251",fill:"#EB4335"})]})}),(0,i.jsx)("span",{className:u().textSpan,children:(0,i.jsx)("p",{children:"Continue with Google"})})]}),(0,i.jsx)("h2",{className:"w-full text-center leading-[0.1em] border-b-2",children:(0,i.jsx)("span",{className:"text-white px-2.5 bg-[#1A202C] font-bold",children:"or"})}),(0,i.jsxs)(f.NI,{id:"email",children:[(0,i.jsx)(y.l,{color:"white",children:"Email/Username"}),(0,i.jsx)(S.I,{color:"white",type:"email",name:"email",onChange:this.handleChange})]}),(0,i.jsxs)(f.NI,{id:"password",children:[(0,i.jsx)(y.l,{color:"white",children:"Password"}),(0,i.jsxs)(v.B,{children:[(0,i.jsx)(S.I,{type:this.state.showPassword?"text":"password",color:"white",name:"password",onChange:this.handleChange}),(0,i.jsx)(_.x,{h:"full",children:(0,i.jsx)(C.z,{_hover:{bg:"gray.400"},color:"white",variant:"ghost",onClick:()=>{this.setState({showPassword:!this.state.showPassword})},children:this.state.showPassword?(0,i.jsx)(I.O,{}):(0,i.jsx)(P.t,{})})})]})]}),(0,i.jsxs)(w.K,{spacing:10,children:[(0,i.jsx)(w.K,{direction:{base:"column",sm:"row"},align:"start",justify:"space-between",children:(0,i.jsx)("a",{className:"text-blue-500 cursor-pointer hover:underline",onClick:()=>{this.setState({forgotPassword:!0,errorStatus:"",email:""})},children:"Forgot Password?"})}),(0,i.jsx)(C.z,{isLoading:this.state.loading,onClick:this.handleSubmit,className:"rounded-lg",backgroundColor:"blue.400",color:"white",_hover:{bg:"blue.500"},disabled:!this.state.email||!this.state.password,children:"Sign in"})]}),(0,i.jsx)("p",{className:"text-red-600 text-center",children:this.state.errorStatus}),(0,i.jsx)(w.K,{pt:6,children:(0,i.jsxs)(k.x,{color:"white",align:"center",children:["Don't have an account?"," ",(0,i.jsx)(l(),{legacyBehavior:!0,href:this.props.router.query.redir?"/signup?redir=".concat(this.props.router.query.redir):"/signup",children:(0,i.jsx)("a",{className:"text-blue-500 cursor-pointer hover:underline",children:"Sign up"})})]})})]})})]})})]})}constructor(e){super(e),this.handleChange=e=>{this.setState({...this.state,[e.target.name]:e.target.value})},this.handleSubmit=e=>{if(e.preventDefault(),this.setState({loading:!0,errorStatus:""}),p().isEmail(this.state.email.toLowerCase().trim())){let e={email:this.state.email.toLowerCase().trim(),password:this.state.password};(0,U.e5)(N.I8,e.email,e.password).then(()=>{(0,L.Kz)(N.co,"login",{method:"Email",email:e.email}),localStorage.setItem("username","".concat(this.state.username)),document.cookie="loggedIn=true; path=/login",document.cookie="loggedIn=true; path=/signup",document.cookie="loggedIn=true; path=/account",this.props.router.query.redir?d().push(decodeURIComponent(this.props.router.query.redir)):d().push("/")}
1).catch(e=>{if(console.error(e.code),this.setState({loading:!1}),"auth/wrong-password"===e.code){let e=(0,A.IO)((0,A.hJ)(N.db,"users"),(0,A.ar)("email","==",this.state.email.toLowerCase().trim()));(0,A.PL)(e).then(e=>{e.forEach(e=>{e.data().provider&&!e.data().linked?this.setState({errorStatus:"",password:"",alreadyProvider:!0,loading:!1}):this.setState({errorStatus:"Wrong password. Please try again.",loading:!1})})})}else"auth/user-not-found"===e.code?this.setState({errorStatus:"Account not found. Please create an account."}):this.setState({errorStatus:e.code})})}else{let e=(0,A.IO)((0,A.hJ)(N.db,"users"),(0,A.ar)("username","==",this.state.email));(0,A.PL)(e).then(e=>{e.empty&&this.setState({errorStatus:"Account not found. Please create an account.",loading:!1}),e.forEach(e=>{let t=(0,A.JU)(N.db,"users",e.data().username);(0,A.QT)(t).then((function(){let t={email:this.state.email,password:this.state.password};(0,U.e5)(N.I8,e.data().email,t.password).then(()=>{(0,L.Kz)(N.co,"login",{method:"Email",email:e.data().email}),localStorage.setItem("username","".concat(this.state.username)),e.cookie="loggedIn=true; path=/login",e.cookie="loggedIn=true; path=/signup",e.cookie="loggedIn=true; path=/account",this.props.router.query.redir?d().push(decodeURIComponent(this.props.router.query.redir)):d().push("/")}).catch(e=>{if(console.error(e.code),this.setState({loading:!1}),"auth/wrong-password"===e.code){let e=(0,A.IO)((0,A.hJ)(N.db,"users"),(0,A.ar)("username","==",this.state.email));(0,A.PL)(e).then(e=>{e.forEach(e=>{e.data().provider&&!e.data().linked?this.setState({alreadyProvider:!0,loading:!1}):this.setState({errorStatus:"Wrong password. Please try again.",loading:!1})})})}else"auth/user-not-found"===e.code?this.setState({errorStatus:"Account not found. Please create an account."}):this.setState({errorStatus:e.code,loading:!1})})}).bind(this))})})}},this.handleGoogleLogin=async e=>{e.preventDefault(),(0,L.Kz)(N.co,"google_sso_clicked",{page:"login"}),this.setState({loading:!0}),await (0,E.signIn)("google")},this.handleForgotPassword=e=>{this.setState({loading:!0}),e.preventDefault(),(0,U.LS)(N.I8,this.state.email).then(()=>{this.setState({errorStatus:"Please check your email (if it didn't appear, check your spam)"}),this.setState({loading:!1})}).catch(e=>{console.log(e),"auth/user-not-found"==e.code&&(this.setState({errorStatus:"An account with that email does not exist."}),this.setState({loading:!1})),"auth/invalid-email"===e.code&&this.setState({errorStatus:"The email address is badly formatted.",loading:!1})})},this.handleNewProvider=e=>{e.preventDefault(),this.setState({loading:!0});let t=(0,A.JU)(N.db,"users",this.state.username);this.state.username.match(/^[a-zA-Z0-9]*$/)?(0,A.QT)(t).then(e=>{if(e.exists())this.setState({errorStatus:"Username is already taken",loading:!1});else{let e=this.state.email.toLowerCase();e=e.replace(/\s/g,"");let s=this.state.firstName.trim();s=s.charAt(0).toUpperCase()+s.slice(1).toLowerCase();let i=this.state.lastName.trim();i=i.charAt(0).toUpperCase()+i.slice(1).toLowerCase();var t=N.I8.currentUser.uid;let r={firstName:s,lastName:i,username:this.state.username.trim(),email:e,createdAt:new Date,userId:t,provider:!0,credits:0};(0,A.pl)((0,A.JU)(N.db,"users",this.state.username),r).then(()=>{(0,U.ck)(N.I8.currentUser,{displayName:this.state.username.trim()}).then(()=>{this.props.router.query.redir?d().push(decodeURIComponent(this.props.router.query.redir)):d().push("/")}).catch(e=>{"auth/user-token-expired"===e.code&&(this.props.router.query.redir?d().push(decodeURIComponent(this.props.router.query.redir)):d().push("/"))})})}}):this.setState({errorStatus:"Username cannot contain any special characters or white spaces",loading:!1})},this.linkProvider=e=>{e.preventDefault(),this.setState({loading:!0}),this.state.password.match(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$/)?(0,U.rh)(N.I8,N.Ap).then(e=>{let t=U.w9.credential(e.user.email,this.state.password);(0,U.ZJ)(N.I8.currentUser,t).then(()=>{let e=(0,A.JU)(N.db,"users",N.I8.currentUser.displayName);(0,A.r7)(e,{linked:!0}).then(()=>{this.props.router.query.redir?d().push(decodeURIComponent(this.props.router.query.redir)):d().push("/account"),this.setState({loading:!1})})}).catch(e=>{console.log(e),this.setState({loading:!1,errorStatus:"Error Authenticating. Ensure you log into google with the same email you desire to log into."})})}).catch(()=>{this.setState({loading:!1,errorStatus:"Error Authenticating"})}):this.setState({loading:!1,errorStatus:"Password must be: 6 to 20 characters which contain at least one numeric digit, one uppercase and one lowercase letter"})},this.state={email:"",password:"",errors:[],loading:!0,loggingIn:!1,errorStatus:"",forgotPassword:!1,showPassword:!1,username:"",newProvider:!1,firstName:"",lastName:"",alreadyProvider:!1,submitLink:!1,withEmail:!1},this.handleGoogleLogin=this.handleGoogleLogin.bind(this),this.handleNewProvider=this.handleNewProvider.bind(this),this.handleChange=this.handleChange.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleForgotPassword=this.handleForgotPassword.bind(this)}}t.default=(0,h.withRouter)(e=>{let t=(0,E.useSession)();if("loading"===t.status)return null;if(K.prototype.render)return(0,i.jsx)(K,{session:t,...e});throw Error("You passed a function component, `withSession` is not needed.\nYou can `useSession` directly in your component.")})},8529:function(e){e.exports={body:"login_body__XEdXV",box:"login_box__EAWmR",emailRedirect:"login_emailRedirect__E0opX",googleButton:"login_googleButton__hxpqC",iconSpan:"login_iconSpan__gxwLl",textSpan:"login_textSpan___jKbX",signUp:"login_signUp__iQgwD",home:"login_home__8_r4L",errorMessage:"login_errorMessage__DoDL0",submitBtn:"login_submitBtn__ADYpj",links:"login_links__avjyj",showPasswordContainer:"login_showPasswordContainer__ejwKn",showPassword:"login_showPassword__2OZcd"}}},function(e){e.O(0,[16,551,968,411,774,888,179],function(){return e(e.s=545)}),_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.