fix(auth): secure sessions and app routing
Validate sessions against the API, honor configurable base paths, and route unknown pages to 404. Keep development ports stable so user and admin apps cannot be confused. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Vendored
+1
@@ -0,0 +1 @@
|
||||
import{$ as e,A as t,Ct as n,F as r,G as i,H as a,I as o,M as s,P as c,U as l,V as u,X as d,Z as f,bt as p,et as m,gt as h,it as g,j as _,lt as v,nt as y,q as b,rt as x,tt as S,yt as C,z as w}from"./index-B2VD3zy8.js";var T={class:`login-page`},E={class:`login-page__form-wrap`},D={class:`login-page__card admin-card`},O={class:`login-page__header`},k={key:0,class:`login-page__mock-hint`},A={dir:`ltr`},j={dir:`ltr`},M={key:0,class:`admin-form__error`,role:`alert`},N={class:`admin-form__field`},P={class:`login-page__input-wrap`},F={class:`login-page__field-icon`,"aria-hidden":`true`},I={class:`admin-form__field`},L={class:`login-page__input-wrap login-page__input-wrap--password`},R={class:`login-page__field-icon`,"aria-hidden":`true`},z=[`type`],B=[`aria-label`],V={class:`login-page__remember`},H=[`disabled`],U={key:0,class:`admin-btn__spinner`,"aria-hidden":`true`},W=u(g({__name:`LoginView`,setup(u){let g=o(),W=r(),G=t(),K=w(),q=C(s()?_.phone:``),J=C(s()?_.password:``),Y=C(!0),X=C(!1),Z=s(),Q=d(()=>q.value.trim().length>0&&J.value.length>0);function $(e){return e.replace(/[۰-۹]/g,e=>String(`۰۱۲۳۴۵۶۷۸۹`.indexOf(e))).replace(/[٠-٩]/g,e=>String(`٠١٢٣٤٥٦٧٨٩`.indexOf(e)))}async function ee(){if(!Q.value){G.error=`لطفاً شماره موبایل و رمز عبور را وارد کنید.`;return}if(!await G.login($(q.value.trim()),J.value,Y.value))return;K.success(`خوش آمدید، ${G.fullName}`);let e=typeof W.query.redirect==`string`?W.query.redirect:`/`;g.replace(e)}return(t,r)=>(v(),m(`div`,T,[f(`div`,E,[f(`div`,D,[f(`div`,O,[r[8]||=f(`h2`,{class:`login-page__title`},`ورود به پنل مدیریت`,-1),r[9]||=f(`p`,{class:`login-page__subtitle`},`برای ادامه، اطلاعات حساب کاربری خود را وارد کنید.`,-1),p(Z)?(v(),m(`p`,k,[r[6]||=y(` حالت موک فعال است — `,-1),f(`span`,A,n(p(_).phone),1),r[7]||=y(` / `,-1),f(`span`,j,n(p(_).password),1)])):e(``,!0)]),f(`form`,{class:`admin-form login-page__form`,onSubmit:b(ee,[`prevent`])},[p(G).error?(v(),m(`p`,M,n(p(G).error),1)):e(``,!0),f(`div`,N,[r[10]||=f(`label`,{for:`login-phone`},`شماره موبایل`,-1),f(`div`,P,[f(`span`,F,[x(c,{name:`phone`,size:18})]),h(f(`input`,{id:`login-phone`,"onUpdate:modelValue":r[0]||=e=>q.value=e,type:`tel`,class:`admin-input login-page__input`,placeholder:`۰۹۱۲۱۱۱۱۲۲۲۲`,autocomplete:`username`,inputmode:`tel`,dir:`ltr`,onInput:r[1]||=e=>p(G).clearError()},null,544),[[i,q.value]])])]),f(`div`,I,[r[11]||=f(`label`,{for:`login-password`},`رمز عبور`,-1),f(`div`,L,[f(`span`,R,[x(c,{name:`lock`,size:18})]),h(f(`input`,{id:`login-password`,"onUpdate:modelValue":r[2]||=e=>J.value=e,type:X.value?`text`:`password`,class:`admin-input login-page__input login-page__input--with-toggle`,placeholder:`رمز عبور`,autocomplete:`current-password`,onInput:r[3]||=e=>p(G).clearError()},null,40,z),[[l,J.value]]),f(`button`,{type:`button`,class:`login-page__toggle-password`,"aria-label":X.value?`پنهان کردن رمز`:`نمایش رمز`,onClick:r[4]||=e=>X.value=!X.value},[x(c,{name:X.value?`eye-off`:`eye`,size:18},null,8,[`name`])],8,B)])]),f(`label`,V,[h(f(`input`,{"onUpdate:modelValue":r[5]||=e=>Y.value=e,type:`checkbox`},null,512),[[a,Y.value]]),r[12]||=f(`span`,null,`مرا به خاطر بسپار`,-1)]),f(`button`,{type:`submit`,class:`admin-btn admin-btn--primary login-page__submit`,disabled:!Q.value||p(G).loading},[p(G).loading?(v(),m(`span`,U)):e(``,!0),r[13]||=y(` ورود به پنل `,-1)],8,H)],32)])]),r[14]||=S(`<div class="login-page__brand" data-v-3c4fbd85><div class="login-page__brand-inner" data-v-3c4fbd85><p class="login-page__brand-badge" data-v-3c4fbd85>پارچه</p><h1 class="login-page__brand-title" data-v-3c4fbd85>پنل مدیریت سفارشهای عمده</h1><p class="login-page__brand-text" data-v-3c4fbd85> مدیریت سفارشها، مشتریان، قیمتگذاری، چکها و گزارشهای فروش در یک محیط یکپارچه. </p></div></div>`,1)]))}}),[[`__scopeId`,`data-v-3c4fbd85`]]);export{W as default};
|
||||
Reference in New Issue
Block a user