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

3 lines
9.9 KiB
JavaScript
Raw Normal View History

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dingtalkQrCode-CZGoXXpv.js","./logo_dingtalk-CyDPr22R.js","./admin-BkqzSx7d.js","./admin-B9hvC0K6.css","./dingtalkQrCode-CulsC8mV.css","./larkQrCode-CU-OsbgY.js","./logo_lark-DULIW3z6.js","./wecomQrCode-vygWkRRy.js","./wecomQrCode-DezZNILo.css"])))=>i.map(i=>d[i]);
import{ay as Y,aA as Z,aB as r,b6 as ee,aD as S,aE as D,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 H,aO as ce,b7 as de,b8 as pe,aH as h,aI as k,aJ as Q,ct as fe,aK as G,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-BkqzSx7d.js";import{_ as be,a as we,f as M,d as ke}from"./index-CpcEXECF.js";import{L as Ce,a as xe}from"./LoginContainer-BZNcbgmh.js";import{a as X}from"./auth-setting-B2s82yza.js";const Le={key:0,class:"text-center mt-16"},$e=Y({__name:"QrCodeTab",props:{tabs:{},defaultTab:{}},setup(U){const{login:x}=Z(),p=U,u=r(""),$=r([]),O=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),$.value=await c(),T(u.value),console.log(p.defaultTab),p.defaultTab&&A(p.defaultTab)});const T=m=>{const g=$.value.find(I=>I.auth_type===m);g&&g.config&&(O.value=g.config)},A=m=>{u.value=m,T(m)};return(m,g)=>{const I=S("el-tab-pane"),s=S("el-tabs");return i(),D(s,{modelValue:u.value,"onUpdate:modelValue":g[0]||(g[0]=w=>u.value=w),onTabChange:A},{default:f(()=>[(i(!0),C(q,null,ae(U.tabs,w=>(i(),D(I,{key:w.key,label:w.value,name:w.key},{default:f(()=>[w.key===u.value?(i(),C("div",Le,[(i(),D(se(re(()=>be(Object.assign({"./dingtalkQrCode.vue":()=>F(()=>import("./dingtalkQrCode-CZGoXXpv.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),"./larkQrCode.vue":()=>F(()=>import("./larkQrCode-CU-OsbgY.js"),__vite__mapDeps([5,6,2,3]),import.meta.url),"./wecomQrCode.vue":()=>F(()=>import("./wecomQrCode-vygWkRRy.js"),__vite__mapDeps([7,2,3,8]),import.meta.url)}),`./${w.key}QrCode.vue`,2))),{config:O.value},null,8,["config"]))])):b("",!0)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}}),De={key:0,class:"mb-24"},Ae={key:1},Ie={class:"mb-24"},Ee={class:"mb-24"},Se={key:0,class:"mb-24"},Oe={class:"flex-between w-full"},Re=["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:$}=Z(),{locale:O}=ue({useScope:"global"}),c=r(!1),T=N(),A=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(()=>{O.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(()=>{O.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&&(A.value=e.data.captcha)}).catch(e=>{console.error("Failed to get captcha:",e)})}function te(a){B(a)}H(()=>{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(""),R=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=$.themeInfo)!=null&&e.slogan)||"融合AI-RAG技术的智能知识问答及思维导图综<EFBFBD>