1import{d as _,c as L,w as m,a as e,b as p,u as n,i as A,P as M,j as v,k as u,v as g,f,t as x,h as b,o as D}from"./wct-app-zVoOyqoJ.js";import{F as E}from"./FullLayout-BBdw16bv.js";import{_ as y}from"./ActionButton.vue_vue_type_script_setup_true_lang-B2JWvPiM.js";import{u as S}from"./common.store-CaiisVSK.js";import{A as k}from"./Header-CVlVgCk3.js";import{F as h}from"./DynamicHeroIcon-RtlqcllT.js";import"./auth.store-DGjXzvfG.js";import"./auth.service-DT1Z-eBl.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./Loading-B8sjktwd.js";import"./ModalBlank-AAGEETCW.js";import"./PlusIcon-C88m3W7y.js";import"./XMarkIcon-CGg_meYD.js";import"./format-Grfp2_uY.js";import"./ShieldCheckIcon-DX5I4eE8.js";import"./ExclamationCircleIcon-D3seTqzk.js";import"./FunnelIcon-NuGtbFHR.js";import"./CheckCircleIcon-tJp7k4qQ.js";import"./ChevronDownIcon-CZfG2Avm.js";import"./ChevronRightIcon-i1AkBnM5.js";import"./LinkIcon-D5VYdLA3.js";import"./CogIcon-BkQy7RXp.js";import"./DocumentTextIcon-CINr7rjU.js";import"./ExclamationTriangleIcon-fzphjkuy.js";import"./InformationCircleIcon-DEU9wywc.js";import"./MagnifyingGlassIcon-CX-_6uQF.js";import"./WrenchScrewdriverIcon-DFrP9z1h.js";import"./TableCellsIcon-DAD8p38B.js";import"./UserGroupIcon-B-pr3QHb.js";const U={class:"min-h-screen bg-gray-50 dark:bg-gray-900"},V={class:"bg-white dark:bg-gray-800 shadow-sm"},B={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6"},F={class:"flex items-center gap-3"},C={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 space-y-6"},P={class:"bg-white dark:bg-gray-800 shadow-sm rounded-lg border border-gray-200 dark:border-gray-700"},T={class:"p-6"},z={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},N=["disabled"],O=["disabled"],j={class:"pt-2"},Y={class:"bg-white dark:bg-gray-800 shadow-sm rounded-lg border border-gray-200 dark:border-gray-700"},$={class:"p-6"},q={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},G=["disabled"],H=["disabled"],J={class:"pt-2"},_e=_({__name:"LoginAs",setup(K){const{showToast:l}=S(),a=b({email:"",userId:null}),t=b({email:"",memberId:null}),i=b(!1),d=b(!1),w=async()=>{if(!a.value.userId&&!a.value.email){l("error","Please enter an email or user ID.");return}i.value=!0;try{await k.loginAs(a.value.userId,a.value.email),window.location.href="/"}catch(o){console.error("Login as org error:",o),c(o,"user")}finally{i.value=!1}},I=async()=>{if(!t.value.memberId&&!t.value.email){l("error","Please enter an email or member ID.");return}d.value=!0;try{await k.loginAsMember(t.value.memberId,t.value.email),window.location.href="/"}catch(o){console.error("Login as member error:",o),c(o,"member")}finally{d.value=!1}},c=(o,r)=>{o.response?.status===404?l("error",r==="member"?"Member not found.":"User not found."):o.response?.status===403?l("error",o.response?.data?.message||"You are not allowed to log in as that account."):o.response?.status===422?l("error",o.response?.data?.message||"Invalid input provided."):l("error",`Failed to log in as the ${r}. Please try again.`)};return(o,r)=>(D(),L(E,{title:"Admin ⺠Login As"},{default:m(()=>[e("div",U,[e("div",V,[e("div",B,[e("div",F,[p(n(A),{href:n(M)("admin-user.dashboard"),
1class:"p-2 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",title:"Back to Admin"},{default:m(()=>[...r[4]||(r[4]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])]),_:1},8,["href"]),r[5]||(r[5]=e("div",null,[e("h1",{class:"text-2xl font-semibold text-gray-900 dark:text-white"}," Login As "),e("p",{class:"mt-1 text-sm text-gray-600 dark:text-gray-400"}," Access an account for support and debugging ")],-1))])])]),e("div",C,[e("div",P,[r[8]||(r[8]=e("div",{class:"px-6 pt-6"},[e("h2",{class:"text-lg font-semibold text-gray-900 dark:text-white"}," Login as Org "),e("p",{class:"mt-1 text-sm text-gray-600 dark:text-gray-400"}," Impersonate an organization account (a user). ")],-1)),e("div",T,[e("form",{onSubmit:v(w,["prevent"]),class:"space-y-5"},[e("div",z,[e("div",null,[r[6]||(r[6]=e("label",{for:"org-email",class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"}," Email Address ",-1)),u(e("input",{id:"org-email","onUpdate:modelValue":r[0]||(r[0]=s=>a.value.email=s),type:"email",class:"form-input w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:border-blue-500 focus:ring-blue-500",placeholder:"Enter user email",disabled:!!a.value.userId},null,8,N),[[g,a.value.email]])]),e("div",null,[r[7]||(r[7]=e("label",{for:"org-userId",class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"}," User ID ",-1)),u(e("input",{id:"org-userId","onUpdate:modelValue":r[1]||(r[1]=s=>a.value.userId=s),type:"number",min:"1",class:"form-input w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:border-blue-500 focus:ring-blue-500",placeholder:"Enter user ID",disabled:!!a.value.email},null,8,O),[[g,a.value.userId]])])]),e("div",j,[p(y,{type:"submit",variant:"primary",disabled:i.value||!a.value.userId&&!a.value.email,icon:n(h)},{default:m(()=>[f(x(i.value?"Logging in...":"Login as Org"),1)]),_:1},8,["disabled","icon"])])],32)])]),e("div",Y,[r[11]||(r[11]=e("div",{class:"px-6 pt-6"},[e("h2",{class:"text-lg font-semibold text-gray-900 dark:text-white"}," Login as Member "),e("p",{class:"mt-1 text-sm text-gray-600 dark:text-gray-400"}," Impersonate a team member. They will be dropped into their active organization. ")],-1)),e("div",$,[e("form",{onSubmit:v(I,["prevent"]),class:"space-y-5"},[e("div",q,[e("div",null,[r[9]||(r[9]=e("label",{for:"member-email",class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"}," Email Address ",-1)),u(e("input",{id:"member-email","onUpdate:modelValue":r[2]||(r[2]=s=>t.value.email=s),type:"email",class:"form-input w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:border-blue-500 focus:ring-blue-500",placeholder:"Enter member email",disabled:!!t.value.memberId},null,8,G),[[g,t.value.email]])]),e("div",null,[r[10]||(r[10]=e("label",{for:"member-id",class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"}," Member ID ",-1)),u(e("input",{id:"member-id","onUpdate:modelValue":r[3]||(r[3]=s=>t.value.memberId=s),type:"number",min:"1",class:"form-input w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white focus:border-blue-500 focus:ring-blue-500",placeholder:"Enter member ID",disabled:!!t.value.email},null,8,H),[[g,t.value.memberId]])])]),e("div",J,[p(y,{type:"submit",variant:"primary",disabled:d.value||!t.value.memberId&&!t.value.email,icon:n(h)},{default:m(()=>[f(x(d.value?"Logging in...":"Login as Member"),1)]),_:1},8,["disabled","icon"])])],32)])]),r[12]||(r[12]=e("div",{class:"bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4"},[e("div",{class:"flex"},[e("svg",{class:"h-5 w-5 text-amber-400 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]),e("div",{class:"ml-3"},[e("h3",{class:"text-sm font-medium text-amber-800 dark:text-amber-200"}," Important "),e("p",{class:"mt-1 text-sm text-amber-700 dark:text-amber-300"}," You will be logged in as the specified account. All actions will be performed under it. Use responsibly. ")])])],-1))])])]),_:1}))}});
1export{_e as default};
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.