Files
claude-relay-service/assets/UserLoginView-BB0rxKdy.js
2026-01-22 07:19:11 +00:00

2 lines
5.5 KiB
JavaScript

import{r as u,_ as h,q as k,x as n,z as e,R as c,aT as _,Y as L,L as p,K as m,aq as g,P as x,O as b,J as S,av as V,aU as z,y as i}from"./vue-vendor-R8HMg95E.js";import{_ as C,b as T,a as U,s as M}from"./index-B3t2NHq9.js";import{T as B}from"./ThemeToggle-DRoGUDeP.js";import"./element-plus-BUfCkBQO.js";import"./vendor-Dr8jvgFu.js";const I={class:"relative flex min-h-screen items-center justify-center bg-gray-50 px-4 py-12 dark:bg-gray-900 sm:px-6 lg:px-8"},N={class:"fixed right-4 top-4 z-10"},j={class:"w-full max-w-md space-y-8"},q={class:"rounded-lg bg-white px-6 py-8 shadow dark:bg-gray-800 dark:shadow-xl"},P={class:"mt-1"},A=["disabled"],E={class:"mt-1"},R=["disabled"],D={key:0,class:"rounded-md border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20"},H={class:"flex"},J={class:"ml-3"},K={class:"text-sm text-red-700 dark:text-red-400"},O=["disabled"],Y={key:0,class:"absolute inset-y-0 left-0 flex items-center pl-3"},F={class:"text-center"},G={__name:"UserLoginView",setup(Q){const f=z(),v=T(),y=U(),r=u(!1),a=u(""),t=h({username:"",password:""}),w=async()=>{var d,s;if(!t.username||!t.password){a.value="Please enter both username and password";return}r.value=!0,a.value="";try{await v.login({username:t.username,password:t.password}),M("Login successful!","success"),f.push("/user-dashboard")}catch(o){console.error("Login error:",o),a.value=((s=(d=o.response)==null?void 0:d.data)==null?void 0:s.message)||o.message||"Login failed"}finally{r.value=!1}};return k(()=>{y.initTheme()}),(d,s)=>{const o=V("router-link");return i(),n("div",I,[e("div",N,[c(B,{mode:"dropdown"})]),e("div",j,[s[7]||(s[7]=_('<div data-v-28d542c4><div class="mx-auto flex h-12 w-auto items-center justify-center" data-v-28d542c4><svg class="h-8 w-8 text-blue-600 dark:text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" data-v-28d542c4><path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" data-v-28d542c4></path></svg><span class="ml-2 text-xl font-bold text-gray-900 dark:text-white" data-v-28d542c4>Claude Relay</span></div><h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900 dark:text-white" data-v-28d542c4> User Sign In </h2><p class="mt-2 text-center text-sm text-gray-600 dark:text-gray-400" data-v-28d542c4> Sign in to your account to manage your API keys </p></div>',1)),e("div",q,[e("form",{class:"space-y-6",onSubmit:L(w,["prevent"])},[e("div",null,[s[2]||(s[2]=e("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300",for:"username"}," Username ",-1)),e("div",P,[m(e("input",{id:"username","onUpdate:modelValue":s[0]||(s[0]=l=>t.username=l),autocomplete:"username",class:"relative block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 text-gray-900 placeholder-gray-500 focus:z-10 focus:border-blue-500 focus:outline-none focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-400 dark:focus:ring-blue-400 sm:text-sm",disabled:r.value,name:"username",placeholder:"Enter your username",required:"",type:"text"},null,8,A),[[g,t.username]])])]),e("div",null,[s[3]||(s[3]=e("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300",for:"password"}," Password ",-1)),e("div",E,[m(e("input",{id:"password","onUpdate:modelValue":s[1]||(s[1]=l=>t.password=l),autocomplete:"current-password",class:"relative block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 text-gray-900 placeholder-gray-500 focus:z-10 focus:border-blue-500 focus:outline-none focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-400 dark:focus:ring-blue-400 sm:text-sm",disabled:r.value,name:"password",placeholder:"Enter your password",required:"",type:"password"},null,8,R),[[g,t.password]])])]),a.value?(i(),n("div",D,[e("div",H,[s[4]||(s[4]=e("div",{class:"flex-shrink-0"},[e("svg",{class:"h-5 w-5 text-red-400",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"clip-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z","fill-rule":"evenodd"})])],-1)),e("div",J,[e("p",K,x(a.value),1)])])])):p("",!0),e("div",null,[e("button",{class:"group relative flex w-full justify-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-blue-500 dark:hover:bg-blue-600 dark:focus:ring-blue-400 dark:focus:ring-offset-gray-800",disabled:r.value||!t.username||!t.password,type:"submit"},[r.value?(i(),n("span",Y,s[5]||(s[5]=[e("svg",{class:"h-5 w-5 animate-spin text-white",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",fill:"currentColor"})],-1)]))):p("",!0),b(" "+x(r.value?"Signing In...":"Sign In"),1)],8,O)]),e("div",F,[c(o,{class:"text-sm text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300",to:"/admin-login"},{default:S(()=>s[6]||(s[6]=[b(" Admin Login ",-1)])),_:1,__:[6]})])],32)])])])}}},se=C(G,[["__scopeId","data-v-28d542c4"]]);export{se as default};