PageSourceSearch

https://amle.ie/assets/Login-QF8dZcUt.js

js amle.ie collected 2026-10-04 04:10:05 UTC 8,398 bytes, 1 lines download raw bytes

1import{c as a,j as e,t as r}from"./vendor-ui-DoG2tnCj.js";import{G as D,d as G,B as m,F as H,e as i,I as w,H as W,J as $}from"./index-D5rH5Kj8.js";import{L as v}from"./label-D8bvz-07.js";import{C as J,a as K,b as Q,c as U,d as X}from"./card-DGsoyv2Y.js";import{s as Y}from"./DeviceMobile.es-yesm6Sqp.js";import{h as N}from"./ShieldCheck.es-DDAVxLM-.js";import{m as h}from"./SpinnerGap.es-DH2f9dlw.js";import{I as Z,a as _,b as c}from"./input-otp-OqIOG1zY.js";import"./vendor-supabase-BwKJ0EQr.js";function le(){const[x,k]=a.useState(""),[C,L]=a.useState(""),[o,f]=a.useState(!1),[j,M]=a.useState(!1),[l,u]=a.useState(!1),[n,g]=a.useState(!1),[F,S]=a.useState(""),[p,y]=a.useState(""),[A,P]=a.useState(!1),{signIn:z,signInWithMicrosoft:E,challengeAndVerifyTotp:R,resetPasswordForEmail:B,user:I,loading:b}=D(),d=G();a.useEffect(()=>{!b&&I&&!n&&d("/")},[I,b,n,d]);const T=async()=>{try{M(!0),await E(window.location.origin)}catch(s){console.error("Microsoft login failed:",s),r.error("Microsoft Sign In Failed",{description:s.message||"Could not connect to Microsoft 365. Please verify configuration."}),M(!1)}},V=async s=>{s.preventDefault(),f(!0);try{const t=await z(x,C);t?.needsMfa&&t.factorId?(S(t.factorId),g(!0),r.info("Two-Factor Authentication Required",{description:"Please enter the 6-digit code from Microsoft Authenticator"})):(r.success("Logged in successfully!"),d("/"))}catch(t){console.error("Login attempt failed:",t),r.error("Login Failed",{description:t.message||"Please check your credentials and try again"})}finally{f(!1)}},O=async s=>{if(s&&s.preventDefault(),p.length!==6||!F){r.error("Please enter the 6-digit code");return}try{P(!0),await R(F,p),r.success("2FA Verified! Welcome back."),g(!1),d("/")}catch(t){console.error("2FA verification failed:",t),r.error("Invalid Verification Code",{description:t.message||"The code is invalid or expired. Please check your Authenticator app."})}finally{P(!1)}},q=async s=>{s.preventDefault(),f(!0);try{await B(x),r.success("Password reset link sent!",{description:"Please check your email for the recovery link"}),u(!1)}catch(t){console.error("Password reset request failed:",t),r.error("Reset Failed",{description:t.message||"An error occurred while sending reset email"})}finally{f(!1)}};return b?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(h,{className:"animate-spin text-accent",size:24}),e.jsx("p",{className:"text-lg font-medium",children:"Checking authentication..."})]})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-6",children:e.jsxs(J,{className:"glass w-full max-w-md border-2 border-white/10 shadow-2xl overflow-hidden",children:[e.jsx("div",{className:"h-1.5 bg-gradient-to-r from-accent via-emerald-500 to-sky-500"}),e.jsxs(K,{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(m,{variant:"ghost",size:"icon",onClick:()=>{n?(g(!1),y("")):l?u(!1):d("/")},children:e.jsx(H,{size:20})}),e.jsx(Q,{className:"text-2xl font-bold tracking-tight",children:n?e.jsx(i,{children:"Two-Factor Verification | Fíorú 2FA"}):l?e.jsx(i,{children:"Reset Password | Athshocraigh Pasfhocal"}):e.jsx(i,{children:"Officer & Member Sign In | Logáil Isteach"})})]}),e.jsx(U,{children:n?e.jsx(i,{children:"Enter the 6-digit code from Microsoft Authenticator | Cuir isteach an cód 6-dhigit ó Microsoft Authenticator"}):l?e.jsx(i,{children:"Enter your email to receive a password recovery link | Cuir isteach do ríomhphost chun nasc athshocraithe a fháil"}):e.jsx(i,{children:"Access your AMLÉ officer dashboard or portal | Faigh rochtain ar do dheais oifigigh nó tairseach AMLÉ"})})]}),e.jsxs(X,{className:"space-y-6",children:[n?e.jsxs("form",{onSubmit:O,className:"space-y-6 flex flex-col items-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-accent/10 border border-accent/20 flex items-center justify-center text-accent",children:e.jsx(N,{size:32})}),e.jsx("div",{className:"space-y-2 text-center w-full",children:e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center justify-center gap-1.5",children:[e.jsx(Y,{size:16,className:"text-accent"}),"Open Microsoft Authenticator on your phone"]})}),e.jsx(Z,{maxLength:6,value:p,onChange:s=>y(s),children:e.jsxs(_,{children:[e.jsx(c,{index:0}),e.jsx(c,{index:1}),e.jsx(c,{index:2}),e.jsx(c,{index:3}),e.jsx(c,{index:4}),e.jsx(c,{index:5})]})}),e.jsxs(m,{className:"w-full bg-accent text-accent-foreground font-semibold h-11 rounded-xl",type:"submit",disabled:A||p.length!==6,children:[A?e.jsx(h,{className:"animate-spin mr-2",size:18}):e.jsx(N,{className:"mr-2",size:18}),"Verify & Access Dashboard"]}),e.jsx("button",{type:"button",onClick:()=>{g(!1),y("")},className:"text-xs text-muted-foreground hover:text-foreground",children:"Back to sign in"})]}):l?e.jsxs("form",{onSubmit:q,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"email",children:"Email"}),e.jsx(w,{id:"email",type:"email",placeholder:"[email protected]",value:x,onChange:s=>k(s.target.value),required:!0})]}),e.jsxs(m,{className:"w-full h-11 rounded-xl",type:"submit",disabled:o,children:[o?e.jsx(h,{className:"animate-spin mr-2",size:18}):e.jsx(W,{className:"mr-2",size:18,weight:"bold"}),"Send Reset Link"]})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(m,{type:"button",onClick:T,disabled:j||o,variant:"outline",className:"w-full h-12 rounded-xl bg-card hover:bg-muted/80 border-2 border-sky-500/30 hover:border-sky-500/60 transition-all text-sm font-semibold flex items-center justify-center gap-3 shadow-md group relative overflow-hidden",children:[j?e.jsx(h,{className:"animate-spin text-sky-400",size:20}):e.jsxs("svg",{className:"w-5 h-5 shrink-0",viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("rect",{x:"1",y:"1",width:"9",height:"9",fill:"#F25022"}),e.jsx("rect",{x:"11",y:"1",width:"9",height:"9",fill:"#7FBA00"}),e.jsx("rect",{x:"1",y:"11",width:"9",height:"9",fill:"#00A4EF"}),e.jsx("rect",{x:"11",y:"11",width:"9",height:"9",fill:"#FFB900"})]}),e.jsx("span",{children:e.jsx(i,{children:"Sign in with Microsoft 365 | Logáil isteach le Microsoft 365"})})]}),e.jsxs("p",{className:"text-[11px] text-center text-muted-foreground flex items-center justify-center gap-1",children:[e.jsx(N,{size:14,className:"text-emerald-400"}
1),"Restricted to @amle.ie accounts • Enforces Microsoft Authenticator"]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-white/10"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-3 text-muted-foreground font-semibold tracking-wider",children:"Or sign in with email"})})]}),e.jsxs("form",{onSubmit:V,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"email",children:"Email"}),e.jsx(w,{id:"email",type:"email",placeholder:"[email protected]",value:x,onChange:s=>k(s.target.value),required:!0,className:"h-11 rounded-xl bg-background/50"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx(v,{htmlFor:"password",children:"Password"}),e.jsx("button",{type:"button",onClick:()=>u(!0),className:"text-xs text-accent hover:underline",children:"Forgot password?"})]}),e.jsx(w,{id:"password",type:"password",value:C,onChange:s=>L(s.target.value),required:!0,className:"h-11 rounded-xl bg-background/50"})]}),e.jsxs(m,{className:"w-full h-11 rounded-xl bg-accent text-accent-foreground font-semibold",type:"submit",disabled:o||j,children:[o?e.jsx(h,{className:"animate-spin mr-2",size:18}):e.jsx($,{className:"mr-2",size:18,weight:"bold"}),"Sign In with Password"]})]})]}),e.jsx("div",{className:"text-center text-sm",children:e.jsx("p",{className:"text-muted-foreground text-xs",children:l?e.jsx("button",{onClick:()=>u(!1),className:"text-accent hover:underline font-medium",children:"Back to Sign In"}):e.jsx("span",{className:"text-muted-foreground",children:"Public registration is closed. Access is restricted to authorized AMLÉ personnel."})})})]})]})})}export{le as Login};

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.