Files
aso/public/dashboard/assets/Login.ba740c88.js
2022-08-04 08:45:27 +07:00

2 lines
3.7 KiB
JavaScript

import{n as F,_ as A,u as y,a as H,b as T,r as j,c as E,d as g,e as U,j as a,F as _,S as m,f as t,A as f,R as w,I as q,g as B,h as $,L as x,i as v,k as W,o as D,l as b,m as z,T as c,C as M,B as O,p as G,q as N,s as V,t as o}from"./index.8dfdc9ed.js";import{P as J}from"./Page.2c1cad43.js";import{R as K}from"./RHFCheckbox.5a431a5e.js";import{C as Q}from"./Card.57605f6f.js";import"./FormControlLabel.9a854fe5.js";function X(e){return e.charAt(0).toUpperCase()+e.substr(1)}function Y(e){return X(e.toLowerCase())}function Z(e,s){return s===void 0&&(s={}),F(e,A({delimiter:" ",transform:Y},s))}function i(e,s){return`${e}${s}`}const r="/auth",ee={root:r,login:i(r,"/login"),register:i(r,"/register"),loginUnprotected:i(r,"/login-unprotected"),registerUnprotected:i(r,"/register-unprotected"),verify:i(r,"/verify"),resetPassword:i(r,"/reset-password")};function te(){const{login:e}=y(),s=H(),d=T(),[l,S]=j.exports.useState(!1),C=E().shape({email:g().email("Email must be a valid email address").required("Email is required"),password:g().required("Password is required")}),k={email:"admin@linksehat.dev",password:"password",remember:!0},u=U({resolver:D(C),defaultValues:k}),{reset:I,setError:L,handleSubmit:P,formState:{errors:p,isSubmitting:R}}=u;return a(_,{methods:u,onSubmit:P(async h=>{try{const n=await e(h.email,h.password);s("/dashboard")}catch(n){console.error(n),I(),d.current&&L("afterSubmit",{...n,message:n.data.message})}}),children:[a(m,{spacing:3,children:[t(f,{severity:"info",children:"Email : admin@linksehat.dev & Password : password"}),!!p.afterSubmit&&t(f,{severity:"error",children:p.afterSubmit.message}),t(w,{name:"email",label:"Email address"}),t(w,{name:"password",label:"Password",type:l?"text":"password",InputProps:{endAdornment:t(q,{position:"end",children:t(B,{onClick:()=>S(!l),edge:"end",children:t($,{icon:l?"eva:eye-fill":"eva:eye-off-fill"})})})}})]}),a(m,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{my:2},children:[t(K,{name:"remember",label:"Remember me"}),t(x,{component:v,variant:"subtitle2",to:ee.resetPassword,children:"Forgot password?"})]}),t(W,{fullWidth:!0,size:"large",type:"submit",variant:"contained",loading:R,children:"Login"})]})}const se=o("div")(({theme:e})=>({[e.breakpoints.up("md")]:{display:"flex"}})),ae=o("header")(({theme:e})=>({top:0,zIndex:9,lineHeight:0,width:"100%",display:"flex",alignItems:"center",position:"absolute",padding:e.spacing(3),justifyContent:"space-between",[e.breakpoints.up("md")]:{alignItems:"flex-start",padding:e.spacing(7,5,0,7)}}));o(Q)(({theme:e})=>({width:"100%",maxWidth:464,display:"flex",flexDirection:"column",justifyContent:"center",margin:e.spacing(2,0,2,2)}));const re=o("div")(({theme:e})=>({maxWidth:480,margin:"auto",display:"flex",minHeight:"100vh",flexDirection:"column",justifyContent:"center",padding:e.spacing(12,0)}));function me(){const{method:e}=y(),s=b("up","sm");return b("up","md"),t(J,{title:"Login",children:a(se,{children:[a(ae,{children:[t(z,{sx:{width:150,height:150}}),s&&a(c,{variant:"body2",sx:{mt:{md:-2}},children:["Has problem with your account? ","",t(x,{variant:"subtitle2",component:v,to:"#",onClick:d=>{window.location.href="mailto:admin@linksehat.com",d.preventDefault()},children:"Contact Us"})]})]}),t(M,{maxWidth:"sm",children:a(re,{children:[a(m,{direction:"row",alignItems:"center",sx:{mb:5},children:[a(O,{sx:{flexGrow:1},children:[t(c,{variant:"h4",gutterBottom:!0,children:"Sign in to LinkSehat"}),t(c,{sx:{color:"text.secondary"},children:"Enter your details below."})]}),t(G,{title:Z(e),placement:"right",children:t(N,{children:t(V,{disabledEffect:!0,src:`https://minimal-assets-api.vercel.app/assets/icons/auth/ic_${e}.png`,sx:{width:32,height:32}})})})]}),t(te,{}),!1]})})]})})}export{me as default};