mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 21:17:30 +00:00
2 lines
5.3 KiB
JavaScript
2 lines
5.3 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 m,K as p,aq as g,P as b,O as x,J as S,av as z,aU as C,y as i}from"./vue-vendor-DV7DYXbz.js";import{b as T,a as V,s as M}from"./index-p8cKYBY8.js";import{T as U}from"./ThemeToggle-CDMqn7Rp.js";import"./element-plus-BSjV1f9S.js";import"./vendor-Dr8jvgFu.js";const B={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"},I={class:"mt-1"},P=["disabled"],A={class:"mt-1"},E=["disabled"],R={key:0,class:"rounded-md border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20"},D={class:"flex"},H={class:"ml-3"},J={class:"text-sm text-red-700 dark:text-red-400"},K=["disabled"],O={key:0,class:"absolute inset-y-0 left-0 flex items-center pl-3"},Y={class:"text-center"},$={__name:"UserLoginView",setup(F){const f=C(),y=T(),v=V(),t=u(!1),o=u(""),s=h({username:"",password:""}),w=async()=>{var l,r;if(!s.username||!s.password){o.value="Please enter both username and password";return}t.value=!0,o.value="";try{await y.login({username:s.username,password:s.password}),M("Login successful!","success"),f.push("/user-dashboard")}catch(a){console.error("Login error:",a),o.value=((r=(l=a.response)==null?void 0:l.data)==null?void 0:r.message)||a.message||"Login failed"}finally{t.value=!1}};return k(()=>{v.initTheme()}),(l,r)=>{const a=z("router-link");return i(),n("div",B,[e("div",N,[c(U,{mode:"dropdown"})]),e("div",j,[r[7]||(r[7]=_('<div><div class="mx-auto flex h-12 w-auto items-center justify-center"><svg class="h-8 w-8 text-blue-600 dark:text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><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"></path></svg><span class="ml-2 text-xl font-bold text-gray-900 dark:text-white">Claude Relay</span></div><h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900 dark:text-white"> User Sign In </h2><p class="mt-2 text-center text-sm text-gray-600 dark:text-gray-400"> 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,[r[2]||(r[2]=e("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300",for:"username"}," Username ",-1)),e("div",I,[p(e("input",{id:"username","onUpdate:modelValue":r[0]||(r[0]=d=>s.username=d),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:t.value,name:"username",placeholder:"Enter your username",required:"",type:"text"},null,8,P),[[g,s.username]])])]),e("div",null,[r[3]||(r[3]=e("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300",for:"password"}," Password ",-1)),e("div",A,[p(e("input",{id:"password","onUpdate:modelValue":r[1]||(r[1]=d=>s.password=d),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:t.value,name:"password",placeholder:"Enter your password",required:"",type:"password"},null,8,E),[[g,s.password]])])]),o.value?(i(),n("div",R,[e("div",D,[r[4]||(r[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",H,[e("p",J,b(o.value),1)])])])):m("",!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:t.value||!s.username||!s.password,type:"submit"},[t.value?(i(),n("span",O,r[5]||(r[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)]))):m("",!0),x(" "+b(t.value?"Signing In...":"Sign In"),1)],8,K)]),e("div",Y,[c(a,{class:"text-sm text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300",to:"/admin-login"},{default:S(()=>r[6]||(r[6]=[x(" Admin Login ",-1)])),_:1,__:[6]})])],32)])])])}}};export{$ as default};
|