7 lines
4.2 KiB
JavaScript
7 lines
4.2 KiB
JavaScript
import{ae as C,b as N,v as y,af as F,D as S,r as a,j as s,C as P,R,l as E,ag as G,m as n,B as z,ah as L,ai as O}from"./index-B92aEPQH.js";import{C as A}from"./Card-DPmHd5BI.js";import{A as u,F as B}from"./Form-C1ZJqG7w.js";import{F as p}from"./FormLabel-DFBiGE9d.js";import{F as g}from"./FormControl-BhzYseFY.js";import"./FormCheck-QYGhbIhB.js";import"./FormContext-IkkKm1bh.js";function D(t){return C({attr:{version:"1.1",x:"0px",y:"0px",viewBox:"0 0 48 48",enableBackground:"new 0 0 48 48"},child:[{tag:"path",attr:{fill:"#FFC107",d:`M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12\r
|
|
c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24\r
|
|
c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z`},child:[]},{tag:"path",attr:{fill:"#FF3D00",d:`M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657\r
|
|
C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z`},child:[]},{tag:"path",attr:{fill:"#4CAF50",d:`M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36\r
|
|
c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z`},child:[]},{tag:"path",attr:{fill:"#1976D2",d:`M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571\r
|
|
c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z`},child:[]}]})(t)}const H={no_account:"You don't have an account with this email. Retry with another Gmail or log in with your email and password.",disabled:"This account is disabled",error:"Google login failed. Try again."},U=()=>{const{login:t}=N(),f=y(),o=F(),[j]=S(),[i,v]=a.useState(""),[l,b]=a.useState(""),[c,d]=a.useState(H[j.get("google")]||""),[m,I]=a.useState(o.state?.resetOk?"Password updated. You can log in now.":""),[h,x]=a.useState(!1),w=async e=>{e.preventDefault(),d(""),x(!0);try{await t(i,l);const r=o.state?.from||"/dashboard";f(r,{replace:!0})}catch(r){d(r.message||"Invalid email or password")}finally{x(!1)}};return s.jsxs("div",{className:"auth-pr-login",children:[s.jsx("div",{className:"auth-pr-bg","aria-hidden":"true"}),s.jsx(P,{children:s.jsx(R,{className:"justify-content-center",children:s.jsxs(E,{xxl:4,md:6,sm:8,children:[s.jsxs(A,{className:"auth-pr-card p-4",children:[s.jsx("div",{className:"auth-brand text-center mb-4",children:s.jsx("img",{src:G,alt:"Pulmonary Rehabilitation Program",height:140})}),m?s.jsx(u,{variant:"success",children:m}):null,c?s.jsx(u,{variant:"danger",children:c}):null,s.jsxs(B,{onSubmit:w,autoComplete:"off",children:[s.jsxs("div",{className:"mb-3 form-group",children:[s.jsxs(p,{children:["Email address ",s.jsx("span",{className:"text-danger",children:"*"})]}),s.jsx(g,{type:"email",name:"email",value:i,onChange:e=>v(e.target.value),autoComplete:"off",required:!0})]}),s.jsxs("div",{className:"mb-3 form-group",children:[s.jsxs(p,{children:["Password ",s.jsx("span",{className:"text-danger",children:"*"})]}),s.jsx(g,{type:"password",name:"password",value:l,onChange:e=>b(e.target.value),autoComplete:"new-password",required:!0})]}),s.jsx("div",{className:"mb-3 text-end",children:s.jsx(n,{to:"/forgot-password",children:"Forgot password?"})}),s.jsx("div",{className:"d-grid",children:s.jsx(z,{type:"submit",className:"btn-primary fw-semibold py-2",disabled:h,children:h?s.jsx(L,{size:"sm"}):"Log in"})})]}),s.jsxs("div",{className:"d-flex align-items-center my-3",children:[s.jsx("hr",{className:"flex-grow-1 m-0"}),s.jsx("span",{className:"px-3 text-muted fw-semibold",children:"OR"}),s.jsx("hr",{className:"flex-grow-1 m-0"})]}),s.jsx("div",{className:"d-grid",children:s.jsxs("a",{href:"/api/auth/google/start",className:"btn btn-outline-secondary fw-semibold py-2 d-flex align-items-center justify-content-center gap-2",children:[s.jsx(D,{size:20})," Login with Gmail"]})})]}),s.jsxs("p",{className:"text-center auth-pr-footer mt-4 mb-0",children:[s.jsx(n,{to:"/privacy",children:"Privacy Policy"}),s.jsx("span",{className:"mx-2",children:"·"}),s.jsx(n,{to:"/terms",children:"Terms of Use"})]}),s.jsx("p",{className:"text-center auth-pr-footer mt-2 mb-0",children:s.jsx(O,{})})]})})})]})};export{U as default};
|