Files
archie/ui/dist/assets/AuthenticationPage.js
T
sam a5137a4eca refactor(ui): audit leftovers use Alert, Item, CodeView and Tooltip
Inline error paragraphs become destructive Alerts, divided record lists
become Item rows, the redirect URI box uses CodeView, and icon-button
title hints use Tooltip. Native titles remain on truncated values and on
disabled controls.
2026-10-26 22:35:47 +11:00

1 line
2.7 KiB
JavaScript

import{A as e,C as t,M as n,S as r,Xt as i,_t as a,b as o,dt as s,ir as c,jn as l,k as u,t as d,x as f,xn as p,y as m}from"./PageHeader.js";import{N as h,d as g,ot as _,r as v,u as y}from"./createLucideIcon.js";import{t as b}from"./input.js";import{A as x,c as S,gt as C,nt as w}from"./index.js";var T={class:`flex items-center justify-end gap-2 border-t border-border pt-3`},E=n({__name:`AuthenticationPage`,setup(n){let E=p({public_url:``,oidc_issuer:``,oidc_audience:``,oidc_client_id:``}),D=p(!1),O=p(``),k=p(!1),A=p(!1);s(async()=>{try{E.value=await v.authentication(),D.value=!0}catch(e){O.value=String(e.message||e)}});let j=m(()=>`${E.value.public_url.replace(/\/$/,``)}/oauth2/callback`);async function M(){k.value=!0,O.value=``,A.value=!1;try{await v.saveAuthentication(E.value),A.value=!0}catch(e){O.value=String(e.message||e)}finally{k.value=!1}}return(n,s)=>(a(),t(`div`,null,[e(d,{title:`Authentication`}),O.value?(a(),f(l(g),{key:0,variant:`destructive`,class:`mb-4`},{default:i(()=>[e(l(y),null,{default:i(()=>[u(c(O.value)+` `,1),s[4]||=o(`a`,{class:`underline`,href:`/?reauth=1`},`Sign in again`,-1)]),_:1})]),_:1})):r(``,!0),D.value?(a(),t(`form`,{key:1,onSubmit:_(M,[`prevent`])},[e(l(x),{title:`Instance URL`},{default:i(()=>[e(l(S),{label:`Public address`,for:`instance-url`,hint:`Passkeys require HTTPS and a domain name, or localhost. Once passkeys are enrolled, their domain is fixed.`},{default:i(()=>[e(l(b),{id:`instance-url`,modelValue:E.value.public_url,"onUpdate:modelValue":s[0]||=e=>E.value.public_url=e,type:`url`,required:``},null,8,[`modelValue`])]),_:1})]),_:1}),e(l(x),{title:`OpenID Connect`},{default:i(()=>[e(l(S),{label:`Issuer URL`,for:`oidc-issuer`},{default:i(()=>[e(l(b),{id:`oidc-issuer`,modelValue:E.value.oidc_issuer,"onUpdate:modelValue":s[1]||=e=>E.value.oidc_issuer=e,type:`url`,placeholder:`https://identity.example.com`},null,8,[`modelValue`])]),_:1}),e(l(S),{label:`Client ID`,for:`oidc-client`},{default:i(()=>[e(l(b),{id:`oidc-client`,modelValue:E.value.oidc_client_id,"onUpdate:modelValue":s[2]||=e=>E.value.oidc_client_id=e},null,8,[`modelValue`])]),_:1}),e(l(S),{label:`Access token audience`,for:`oidc-audience`},{default:i(()=>[e(l(b),{id:`oidc-audience`,modelValue:E.value.oidc_audience,"onUpdate:modelValue":s[3]||=e=>E.value.oidc_audience=e},null,8,[`modelValue`])]),_:1}),e(l(S),{label:`Redirect URI`,hint:`Add permitted people in Organisation → Members.`},{default:i(()=>[e(w,{code:j.value},null,8,[`code`])]),_:1}),o(`div`,T,[A.value?(a(),f(l(C),{key:0,role:`status`,"aria-label":`Saved`,class:`size-4 text-fg-muted`})):r(``,!0),e(l(h),{type:`submit`,disabled:k.value},{default:i(()=>[...s[5]||=[u(`Save`,-1)]]),_:1},8,[`disabled`])])]),_:1})],32)):r(``,!0)]))}});export{E as default};