mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-07-21 09:03:23 +02:00
1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
import{dt as e,g as t,j as n,l as r,m as i,p as a,s as o,u as s,w as c,z as l}from"./runtime-core.esm-bundler-IofF4kUm.js";import{i as u}from"./vue-router-BsDVl_JC.js";import{n as d,o as f,u as p}from"./api-DGrRo_Ft.js";import{t as m}from"./_plugin-vue_export-helper-V-yks4gF.js";import{f as h,h as g,i as _,r as v,t as y}from"./index-COnQNCNU.js";var b={class:`glass-card backdrop-blur-xl border border-stroke-subtle dark:border-white/20 rounded-[15px] p-6 max-w-md w-full shadow-2xl`},x={key:0,class:`bg-red-500/10 border border-red-500/30 rounded-lg p-3`},S={class:`text-red-600 dark:text-red-400 text-sm`},C={key:1,class:`bg-green-500/10 border border-green-600/40 dark:border-green-500/30 rounded-lg p-3`},w={class:`text-green-600 dark:text-green-400 text-sm`},T={class:`flex justify-end gap-3 mt-6`},E=[`disabled`],D=[`disabled`],O={key:0,class:`w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin`},k=t({name:`ChangePasswordModal`,__name:`ChangePasswordModal`,props:{isOpen:{type:Boolean},canSkip:{type:Boolean,default:!0}},emits:[`close`,`success`],setup(t,{emit:i}){let u=i,f=l(``),p=l(``),m=l(``),_=l(!1),v=l(``),y=l(``),k=()=>{_.value||u(`close`)},A=()=>{u(`close`)},j=async()=>{if(v.value=``,y.value=``,p.value.length<8){v.value=`New password must be at least 8 characters long`;return}if(p.value!==m.value){v.value=`Passwords do not match`;return}if(p.value===f.value){v.value=`New password must be different from current password`;return}_.value=!0;try{let e=(await d.post(`/auth/change_password`,{current_password:f.value,new_password:p.value})).data;e&&e.success?(y.value=e.message||`Password changed successfully!`,setTimeout(()=>{u(`success`),u(`close`)},1500)):v.value=e?.error||`Failed to change password`}catch(e){console.error(`Password change error:`,e),v.value=e.response?.data?.error||`Failed to change password. Please try again.`}finally{_.value=!1}};return(i,l)=>t.isOpen?(c(),s(`div`,{key:0,class:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm`,onClick:g(k,[`self`])},[o(`div`,b,[l[6]||=o(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary mb-2`},` Change Default Password `,-1),l[7]||=o(`p`,{class:`text-content-secondary dark:text-content-muted text-sm mb-6`},` You're using the default password. Please change it to secure your account. `,-1),o(`form`,{onSubmit:g(j,[`prevent`]),class:`space-y-4`},[o(`div`,null,[l[3]||=o(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2`},`Current Password`,-1),n(o(`input`,{"onUpdate:modelValue":l[0]||=e=>f.value=e,type:`password`,required:``,class:`w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors`,placeholder:`Enter current password`},null,512),[[h,f.value]])]),o(`div`,null,[l[4]||=o(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2`},`New Password`,-1),n(o(`input`,{"onUpdate:modelValue":l[1]||=e=>p.value=e,type:`password`,required:``,minlength:`8`,class:`w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors`,placeholder:`Enter new password (min 8 characters)`},null,512),[[h,p.value]])]),o(`div`,null,[l[5]||=o(`label`,{class:`block text-sm font-medium text-content-secondary dark:text-content-primary/70 mb-2`},`Confirm New Password`,-1),n(o(`input`,{"onUpdate:modelValue":l[2]||=e=>m.value=e,type:`password`,required:``,minlength:`8`,class:`w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors`,placeholder:`Confirm new password`},null,512),[[h,m.value]])]),v.value?(c(),s(`div`,x,[o(`p`,S,e(v.value),1)])):r(``,!0),y.value?(c(),s(`div`,C,[o(`p`,w,e(y.value),1)])):r(``,!0),o(`div`,T,[t.canSkip?(c(),s(`button`,{key:0,type:`button`,onClick:A,disabled:_.value,class:`px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/10 transition-colors disabled:opacity-50`},` Skip for Now `,8,E)):r(``,!0),o(`button`,{type:`submit`,disabled:_.value,class:`px-4 py-2 bg-primary/20 hover:bg-primary/30 text-white rounded-lg border border-primary/50 transition-colors disabled:opacity-50 flex items-center gap-2`},[_.value?(c(),s(`div`,O)):r(``,!0),a(` `+e(_.value?`Changing...`:`Change Password`),1)],8,D)])],32)])])):r(``,!0)}}),A={class:`min-h-screen bg-background dark:bg-background overflow-hidden relative flex items-start sm:items-center justify-center p-2 sm:p-4 pt-8 sm:pt-4`},j={class:`absolute top-4 right-4 z-20`},M={class:`login-card relative z-10 w-full max-w-md p-6 sm:p-10 rounded-[16px] sm:rounded-[24px] border-0 sm:border sm:border-stroke-subtle dark:sm:border-stroke/20 shadow-[0_8px_32px_0_rgba(0,0,0,0.1)] dark:shadow-[0_8px_32px_0_rgba(0,0,0,0.37)] backdrop-blur-xl`},N={class:`relative login-content`},P={class:`form-group`},F={class:`relative`},I=[`disabled`],L={class:`form-group`},R={class:`relative`},z=[`disabled`],B={key:0,class:`bg-red-500/10 border border-red-500/30 rounded-[12px] p-2.5 sm:p-3.5 backdrop-blur-sm animate-shake`},V={class:`text-red-600 dark:text-red-400 text-xs sm:text-sm font-medium`},H=[`disabled`],U={key:0,class:`w-4 h-4 sm:w-5 sm:h-5 border-2 border-white border-t-transparent rounded-full animate-spin`},W={key:1,class:`w-4 h-4 sm:w-5 sm:h-5 group-hover:translate-x-1 transition-transform duration-300`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},G={class:`relative`},K={class:`mt-6 sm:mt-8 pt-4 sm:pt-6 border-t border-stroke-subtle dark:border-stroke/10`},q={class:`flex items-center justify-center gap-3`},J={href:`https://github.com/rightup`,target:`_blank`,class:`inline-flex items-center justify-center w-9 h-9 sm:w-10 sm:h-10 rounded-xl bg-content-primary dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 hover:bg-primary/20 dark:hover:bg-primary/30 hover:border-primary/50 transition-all duration-300 hover:scale-110 group backdrop-blur-sm`,title:`GitHub`},Y={href:`https://buymeacoffee.com/rightup`,target:`_blank`,class:`inline-flex items-center justify-center w-9 h-9 sm:w-10 sm:h-10 rounded-xl bg-content-primary dark:bg-white/10 border border-stroke-subtle dark:border-stroke/20 hover:bg-yellow-50 dark:hover:bg-yellow-500/20 hover:border-yellow-500/50 transition-all duration-300 hover:scale-110 group backdrop-blur-sm`,title:`Buy Me a Coffee`},X=m(t({name:`LoginView`,__name:`Login`,setup(t){let a=u(),m=l(`admin`),b=l(``),x=l(!1),S=l(``),C=l(!1),w=l(!1),T=async()=>{S.value=``,x.value=!0;try{let e=f(),t=(await d.post(`/auth/login`,{username:m.value,password:b.value,client_id:e})).data;t.success&&t.token?b.value===`admin123`?(p(t.token),w.value=!0,C.value=!0):(p(t.token),a.push(`/`)):S.value=t.error||`Login failed`}catch(e){console.error(`Login error:`,e),S.value=e.response?.data?.error||`Connection error. Please try again.`}finally{x.value=!1}},E=()=>{C.value=!1,a.push(`/`)},D=()=>{C.value=!1,w.value&&a.push(`/`)};return(t,a)=>(c(),s(`div`,A,[o(`div`,j,[i(y)]),a[10]||=o(`div`,{class:`bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-80 animate-pulse-slow -top-[79px] left-[575px] mix-blend-multiply dark:mix-blend-screen pointer-events-none`},null,-1),a[11]||=o(`div`,{class:`bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-75 animate-pulse-slower -top-[94px] -left-[92px] mix-blend-multiply dark:mix-blend-screen pointer-events-none`},null,-1),a[12]||=o(`div`,{class:`bg-gradient-light dark:bg-gradient-dark absolute rounded-full -rotate-[24.22deg] w-[705px] h-[512px] blur-[120px] opacity-80 animate-pulse-slowest top-[373px] left-[246px] mix-blend-multiply dark:mix-blend-screen pointer-events-none`},null,-1),o(`div`,M,[a[9]||=o(`div`,{class:`absolute inset-0 rounded-[24px] bg-gradient-to-br from-primary/3 dark:from-primary/5 to-transparent pointer-events-none`},null,-1),o(`div`,N,[a[8]||=o(`div`,{class:`text-center mb-6 sm:mb-10`},[o(`div`,{class:`mb-4 sm:mb-6 flex justify-center`},[o(`img`,{src:`/assets/pymclogo-ew909fnk.png`,alt:`pyMC`,class:`logo-image logo-image-animated h-36 sm:h-40 relative z-10`})]),o(`p`,{class:`text-content-secondary dark:text-content-muted text-xs sm:text-sm`},` Sign in to access your dashboard `)],-1),o(`form`,{onSubmit:g(T,[`prevent`]),class:`space-y-4 sm:space-y-5`},[o(`div`,P,[a[3]||=o(`label`,{for:`username`,class:`block text-content-secondary dark:text-content-primary/90 text-xs sm:text-sm font-medium mb-2`},` Username `,-1),o(`div`,F,[n(o(`input`,{id:`username`,"onUpdate:modelValue":a[0]||=e=>m.value=e,type:`text`,autocomplete:`username`,required:``,class:`input-glass w-full px-3 sm:px-4 py-2.5 sm:py-3.5 rounded-[12px] text-content-primary dark:text-content-primary text-sm placeholder-gray-400 dark:placeholder-white/30 focus:outline-none focus:border-primary/50 transition-all duration-300`,placeholder:`Enter username`,disabled:x.value},null,8,I),[[h,m.value]]),a[2]||=o(`div`,{class:`absolute inset-0 rounded-[12px] pointer-events-none input-glow`},null,-1)])]),o(`div`,L,[a[5]||=o(`label`,{for:`password`,class:`block text-content-secondary dark:text-content-primary/90 text-xs sm:text-sm font-medium mb-2`},` Password `,-1),o(`div`,R,[n(o(`input`,{id:`password`,"onUpdate:modelValue":a[1]||=e=>b.value=e,type:`password`,autocomplete:`current-password`,required:``,class:`input-glass w-full px-3 sm:px-4 py-2.5 sm:py-3.5 rounded-[12px] text-content-primary dark:text-content-primary text-sm placeholder-gray-400 dark:placeholder-white/30 focus:outline-none focus:border-primary/50 transition-all duration-300`,placeholder:`Enter password`,disabled:x.value},null,8,z),[[h,b.value]]),a[4]||=o(`div`,{class:`absolute inset-0 rounded-[12px] pointer-events-none input-glow`},null,-1)])]),S.value?(c(),s(`div`,B,[o(`p`,V,e(S.value),1)])):r(``,!0),o(`button`,{type:`submit`,disabled:x.value,class:`button-glass w-full relative overflow-hidden bg-primary/20 hover:bg-primary/30 active:scale-[0.98] text-primary dark:text-white font-semibold py-3 sm:py-4 px-4 rounded-[12px] border border-primary/50 hover:border-primary/60 transition-all duration-300 focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2 sm:gap-2.5 group mt-6 sm:mt-8 text-sm sm:text-base backdrop-blur-sm`},[x.value?(c(),s(`div`,U)):(c(),s(`svg`,W,[...a[6]||=[o(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1`},null,-1)]])),o(`span`,G,e(x.value?`Signing in...`:`Sign In`),1)],8,H)],32),o(`div`,K,[a[7]||=o(`div`,{class:`flex flex-col items-center justify-center mb-4`},[o(`p`,{class:`text-content-muted dark:text-content-muted text-[10px] sm:text-xs mb-1.5 tracking-wide uppercase opacity-60`},`Powered by`),o(`img`,{src:`/assets/meshcore-DQNtEl5I.svg`,alt:`MeshCore`,class:`h-4 sm:h-5 opacity-50 brightness-0 dark:brightness-100`})],-1),o(`div`,q,[o(`a`,J,[i(_,{class:`w-5 h-5 sm:w-6 sm:h-6 text-white group-hover:text-primary transition-colors`})]),o(`a`,Y,[i(v,{class:`w-5 h-5 sm:w-6 sm:h-6 text-white group-hover:text-yellow-500 transition-colors`})])])])])]),i(k,{"is-open":C.value,"can-skip":!0,onClose:D,onSuccess:E},null,8,[`is-open`])]))}}),[[`__scopeId`,`data-v-0539335e`]]);export{X as default}; |