PageSourceSearch

https://abiizark4-9router.hf.space/_next/static/chunks/app/login/page-b860537d58a9f64e.js

js abiizark4-9router.hf.space collected 2026-10-03 16:36:45 UTC 5,868 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4520],{82909:(e,t,s)=>{Promise.resolve().then(s.bind(s,83016))},83016:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>n});var a=s(95155),r=s(12115),l=s(35497),i=s(73321);function n(){let[e,t]=(0,r.useState)(""),[s,n]=(0,r.useState)(""),[d,o]=(0,r.useState)(""),[c,x]=(0,r.useState)(0),[u,h]=(0,r.useState)(!1),[m,p]=(0,r.useState)(null),[f,b]=(0,r.useState)("password"),[w,g]=(0,r.useState)(!1),[j,N]=(0,r.useState)("Sign in with OIDC"),[y,v]=(0,r.useState)(!1),[S,C]=(0,r.useState)(""),k=(0,i.useRouter)();(0,r.useEffect)(()=>{if(c<=0)return;let e=setInterval(()=>x(e=>e>0?e-1:0),1e3);return()=>clearInterval(e)},[c]),(0,r.useEffect)(()=>{!async function(){let e=new AbortController,t=setTimeout(()=>e.abort(),5e3),s=window.location.origin;try{let a=await fetch(`${s}/api/auth/status`,{signal:e.signal});if(clearTimeout(t),a.ok){let e=await a.json();if(!1===e.requireLogin){k.push("/dashboard"),k.refresh();return}p(!!e.hasPassword),b(e.authMode||"password"),g(!0===e.oidcConfigured),N(e.oidcLoginLabel||"Sign in with OIDC")}else p(!0)}catch(e){clearTimeout(t),p(!0)}}()},[k]);let P=async t=>{t.preventDefault(),h(!0),n(""),o("");try{let t=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:e})});if(t.ok){if((await t.json()).mustChangePassword)return void v(!0);k.push("/dashboard"),k.refresh()}else{let e=await t.json();n(e.error||"Invalid password"),e.resetHint&&o(e.resetHint),e.retryAfter&&x(Number(e.retryAfter))}}catch(e){n("An error occurred. Please try again.")}finally{h(!1)}},O=async t=>{t.preventDefault(),h(!0),n("");try{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:e,newPassword:S})});if(t.ok)k.push("/dashboard"),k.refresh();else{let e=await t.json();n(e.error||"Failed to set password")}}catch(e){n("An error occurred. Please try again.")}finally{h(!1)}},D=w&&["oidc","both"].includes(f),I="oidc"!==f||!w;return null===m?(0,a.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-bg p-4",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-primary"}),(0,a.jsx)("p",{className:"text-text-muted mt-4",children:"Loading..."})]})}):(0,a.jsxs)("div",{className:"min-h-screen flex items-center justify-center bg-bg p-4 relative overflow-hidden",children:[(0,a.jsx)("div",{className:"landing-grid absolute inset-0 pointer-events-none","aria-hidden":"true"}),(0,a.jsxs)("div",{className:"relative z-10 w-full max-w-md",children:[(0,a.jsxs)("div",{className:"text-center mb-8",children:[(0,a.jsx)("h1",{className:"text-3xl font-bold text-primary mb-2",children:"9Router"}),(0,a.jsx)("p",{className:"text-text-muted",children:"oidc"===f&&w?"Sign in with your OIDC provider to access the dashboard":"Enter your password to access the dashboard"})]}),(0,a.jsx)(l.Zp,{children:y?(0,a.jsxs)("form",{onSubmit:O,className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-sm text-amber-600 dark:text-amber-400 text-center",children:"Set a new password before accessing the dashboard remotely."}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium",children:"New password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Enter new password",value:S,onChange:e=>C(e.target.value),required:!0,autoFocus:!0}),s&&(0,a.jsx)("p",{className:"text-xs text-red-500",children:s})]}),(0,a.jsx)(l.$n,{type:"submit",variant:"primary",className:"w-full",loading:u,disabled:!S,children:"Set password"})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[D&&(0,a.jsx)(l.$n,{type:"button",variant:"primary",className:"w-full",onClick:()=>{window.location.href="/api/auth/oidc/start"},children:j}),D&&I&&(0,a.jsx)("div",{className:"h-px bg-border/60"}),I?(0,a.jsxs)("form",{onSubmit:P,className:"flex flex-col gap-4",children:[("oidc"===f&&!w||"both"===f&&!w)&&(0,a.jsx)("p",{className:"text-xs text-amber-600 dar
1k:text-amber-400 text-center",children:"OIDC login is enabled, but the issuer/client fields are not configured yet. Password login is still available for recovery."}),"both"===f&&w&&(0,a.jsx)("p",{className:"text-xs text-text-muted text-center",children:"Password and OIDC login are both enabled."}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium",children:"Password"}),(0,a.jsx)(l.pd,{type:"password",placeholder:"Enter password",value:e,onChange:e=>t(e.target.value),required:!0,autoFocus:!D}),s&&(0,a.jsx)("p",{className:"text-xs text-red-500",children:s}),c>0&&(0,a.jsxs)("p",{className:"text-xs text-amber-600 dark:text-amber-400",children:["Locked. Retry in ",(0,a.jsxs)("span",{className:"font-mono",children:[c,"s"]}),"."]}),d&&(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Forgot password? Open ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded",children:"9router"})," CLI on the host → ",(0,a.jsx)("b",{children:"Settings"})," → ",(0,a.jsx)("b",{children:"Reset Password to Default"}),"."]})]}),(0,a.jsx)(l.$n,{type:"submit",variant:"primary",className:"w-full",loading:u,disabled:c>0,children:c>0?`Wait ${c}s`:"Login"}),(0,a.jsxs)("p",{className:"text-xs text-center text-text-muted mt-2",children:["Default password is ",(0,a.jsx)("code",{className:"bg-sidebar px-1 rounded",children:"123456"})]}),!1===m&&(0,a.jsx)("p",{className:"text-xs text-center text-amber-600 dark:text-amber-400",children:"Security risk: no password set. You will be asked to set one when logging in remotely."})]}):s&&(0,a.jsx)("p",{className:"text-xs text-red-500",children:s})]})})]})]})}}},e=>{e.O(0,[2574,3862,1051,1321,705,5497,8441,3794,7358],()=>e(e.s=82909)),_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.