UnisKB/static/admin/assets/index-BRuLmkcS.js

3 lines
9.9 KiB
JavaScript
Raw Normal View History

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dingtalkQrCode-BACSCH0q.js","./logo_dingtalk-CyDPr22R.js","./admin-CkbVdLTL.js","./admin-DNnRQ7pR.css","./dingtalkQrCode-CulsC8mV.css","./larkQrCode-BL0ME5jb.js","./logo_lark-DULIW3z6.js","./wecomQrCode-BDsFvNjK.js","./wecomQrCode-DezZNILo.css"])))=>i.map(i=>d[i]);
import{ay as Y,aA as Z,aB as r,b6 as ee,aD as R,aE as $,aF as i,aG as f,aW as C,aY as ae,b1 as b,cp as se,cq as re,aX as q,cr as F,az as ie,cs as ue,aP as N,aC as y,bF as G,aO as ce,b7 as de,b8 as pe,aH as h,aI as k,aJ as Q,ct as fe,aK as H,b2 as J,bd as me,cn as W,cu as ge,c0 as ve,cv as he,c1 as _e,cf as ye}from"./admin-CkbVdLTL.js";import{_ as be,a as we,f as M,d as ke}from"./index-DOysudDJ.js";import{L as Ce,a as xe}from"./LoginContainer-C9GvOo-K.js";import{a as X}from"./auth-setting-B_hGN8DK.js";const Le={key:0,class:"text-center mt-16"},Ae=Y({__name:"QrCodeTab",props:{tabs:{},defaultTab:{}},setup(U){const{login:x}=Z(),p=U,u=r(""),A=r([]),S=r({app_key:"",app_secret:""});async function c(){try{return await x.getQrSource()}catch{return[]}}ee(async()=>{p.tabs.length>0&&(u.value=p.tabs[0].key),A.value=await c(),T(u.value),console.log(p.defaultTab),p.defaultTab&&D(p.defaultTab)});const T=m=>{const g=A.value.find(I=>I.auth_type===m);g&&g.config&&(S.value=g.config)},D=m=>{u.value=m,T(m)};return(m,g)=>{const I=R("el-tab-pane"),s=R("el-tabs");return i(),$(s,{modelValue:u.value,"onUpdate:modelValue":g[0]||(g[0]=w=>u.value=w),onTabChange:D},{default:f(()=>[(i(!0),C(q,null,ae(U.tabs,w=>(i(),$(I,{key:w.key,label:w.value,name:w.key},{default:f(()=>[w.key===u.value?(i(),C("div",Le,[(i(),$(se(re(()=>be(Object.assign({"./dingtalkQrCode.vue":()=>F(()=>import("./dingtalkQrCode-BACSCH0q.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),"./larkQrCode.vue":()=>F(()=>import("./larkQrCode-BL0ME5jb.js"),__vite__mapDeps([5,6,2,3]),import.meta.url),"./wecomQrCode.vue":()=>F(()=>import("./wecomQrCode-BDsFvNjK.js"),__vite__mapDeps([7,2,3,8]),import.meta.url)}),`./${w.key}QrCode.vue`,2))),{config:S.value},null,8,["config"]))])):b("",!0)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}}),$e={key:0,class:"mb-24"},De={key:1},Ie={class:"mb-24"},Ee={class:"mb-24"},Re={key:0,class:"mb-24"},Se={class:"flex-between w-full"},Oe=["src"],Ve={class:"operate-container flex-between mt-12"},Pe={key:2},Qe={key:3,class:"login-gradient-divider lighter mt-24"},Te={class:"text-center mt-16"},Ue=Y({__name:"index",setup(U){const x=ie(),{login:p,user:u,theme:A}=Z(),{locale:S}=ue({useScope:"global"}),c=r(!1),T=N(),D=r(""),m=r(),g=r(null),I=r(""),s=r({username:"",password:"",captcha:""}),w=r({username:[{required:!0,message:y("views.login.loginForm.username.requiredMessage"),trigger:"blur"}],password:[{required:!0,message:y("views.login.loginForm.password.requiredMessage"),trigger:"blur"}],captcha:[{required:!1,message:y("views.login.loginForm.captcha.requiredMessage"),trigger:"blur"}]}),K=()=>{m.value&&m.value.validate(a=>{if(a)if(c.value=!0,L.value==="LDAP")p.asyncLdapLogin(s.value).then(()=>{S.value=localStorage.getItem("MaxKB-locale")||W()||"en-US",x.push({name:"home"})}).catch(()=>{c.value=!1});else{const e=M.pki.publicKeyFromPem(u.rasKey),t=JSON.stringify(s.value),o=M.util.encodeUtf8(t),_=e.encrypt(o,"RSAES-PKCS1-V1_5"),n=M.util.encode64(_);p.asyncLogin({encryptedData:n,username:s.value.username}).then(()=>{S.value=localStorage.getItem("MaxKB-locale")||W()||"en-US",localStorage.setItem("workspace_id","default"),x.push({name:"home"})}).catch(()=>{const v=s.value.username;c.value=!1,B(v)})}})};function B(a){ge.getCaptcha(a).then(e=>{e&&e.data&&e.data.captcha&&(D.value=e.data.captcha)}).catch(e=>{console.error("Failed to get captcha:",e)})}function te(a){B(a)}G(()=>{u.asyncGetProfile().then(a=>{u.isPE()||u.isEE()?X.getLoginAuthSetting().then(e=>{if(Object.keys(e.data).length>0?g.value=e.data:g.value={max_attempts:1,default_value:"LOCAL"},T.query.login_mode!=="manual"){const o=g.value.default_value;["lark","wecom","dingtalk"].includes(o)?(V("QR_CODE",!1),I.value=o):V(o,!1)}}):g.value={max_attempts:1,default_value:"LOCAL"}})});const E=r([""]),j=r([""]),L=r(""),O=r(!1),z=r([]);function oe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){const e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)})}const le=ce(()=>{var e,t,o;return!((e=A.themeInfo)!=null&&e.slogan)||"融合AI-RAG技术的智能知识问答及思维导图综<EFBFBD>