UnisKB/static/chat/assets/index-BeH1BWNA.js

3 lines
10 KiB
JavaScript
Raw Normal View History

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dingtalkQrCode-d4FendqO.js","./logo_dingtalk-CyDPr22R.js","./chat-u6cKkSMp.js","./chat-BnHuRtZt.css","./dingtalkQrCode-CulsC8mV.css","./larkQrCode-D9UasRuW.js","./logo_lark-DULIW3z6.js","./wecomQrCode-UuYuHKG3.js","./wecomQrCode-DezZNILo.css"])))=>i.map(i=>d[i]);
import{ay as Y,aA as Z,aB as r,br as ee,aD as R,aE as i,aF as L,aG as m,bf as C,bh as te,cq as se,cr as re,bm as w,bg as q,cs as M,az as ie,ct as ue,b7 as G,aC as y,bV as N,b8 as ce,bs as de,bt as pe,aH as f,aJ as Q,cu as me,aI as _,aK as H,bn as J,bx as fe,co as W,cv as ge,c6 as ve,cw as he,c7 as _e,ce as be}from"./chat-u6cKkSMp.js";import{_ as ye,a as we,f as F,d as ke}from"./index-C8ZhmsbW.js";import{L as Ce,a as xe}from"./LoginContainer-7D5DXqVu.js";import{a as X}from"./auth-setting-Do-ge5dc.js";import{C as Ae}from"./index-BBfL7ROb.js";const Ie={key:0,class:"text-center mt-16"},Le=Y({__name:"QrCodeTab",props:{tabs:{},defaultTab:{}},setup(U){const{login:x}=Z(),p=U,u=r(""),I=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),I.value=await c(),T(u.value),console.log(p.defaultTab),p.defaultTab&&$(p.defaultTab)});const T=g=>{const v=I.value.find(D=>D.auth_type===g);v&&v.config&&(S.value=v.config)},$=g=>{u.value=g,T(g)};return(g,v)=>{const D=R("el-tab-pane"),s=R("el-tabs");return i(),L(s,{modelValue:u.value,"onUpdate:modelValue":v[0]||(v[0]=k=>u.value=k),onTabChange:$},{default:m(()=>[(i(!0),C(q,null,te(U.tabs,k=>(i(),L(D,{key:k.key,label:k.value,name:k.key},{default:m(()=>[k.key===u.value?(i(),C("div",Ie,[(i(),L(se(re(()=>ye(Object.assign({"./dingtalkQrCode.vue":()=>M(()=>import("./dingtalkQrCode-d4FendqO.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),"./larkQrCode.vue":()=>M(()=>import("./larkQrCode-D9UasRuW.js"),__vite__mapDeps([5,6,2,3]),import.meta.url),"./wecomQrCode.vue":()=>M(()=>import("./wecomQrCode-UuYuHKG3.js"),__vite__mapDeps([7,2,3,8]),import.meta.url)}),`./${k.key}QrCode.vue`,2))),{config:S.value},null,8,["config"]))])):w("",!0)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}}),$e={class:"login-brand"},De={key:0,class:"mb-24"},Ee={key:1},Re={class:"mb-24"},Se={class:"mb-24"},Ve={key:0,class:"mb-24"},Oe={class:"flex-between w-full"},Pe=["src"],Qe={class:"operate-container flex-between mt-12"},Te={key:2},Ue={key:3,class:"login-gradient-divider lighter mt-24"},Be={class:"text-center mt-16"},Me=Y({__name:"index",setup(U){const x=ie(),{login:p,user:u,theme:I}=Z(),{locale:S}=ue({useScope:"global"}),c=r(!1),T=G(),$=r(""),g=r(),v=r(null),D=r(""),s=r({username:"",password:"",captcha:""}),k=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=()=>{g.value&&g.value.validate(t=>{if(t)if(c.value=!0,A.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=F.pki.publicKeyFromPem(u.rasKey),a=JSON.stringify(s.value),o=F.util.encodeUtf8(a),b=e.encrypt(o,"RSAES-PKCS1-V1_5"),n=F.util.encode64(b);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 h=s.value.username;c.value=!1,B(h)})}})};function B(t){ge.getCaptcha(t).then(e=>{e&&e.data&&e.data.captcha&&($.value=e.data.captcha)}).catch(e=>{console.error("Failed to get captcha:",e)})}function ae(t){B(t)}N(()=>{u.asyncGetProfile().then(t=>{u.isPE()||u.isEE()?X.getLoginAuthSetting().then(e=>{if(Object.keys(e.data).length>0?v.value=e.data:v.value={max_attempts:1,default_value:"LOCAL"},T.query.login_mode!=="manual"){const o=v.value.default_value;["lark","wecom","dingtalk"].includes(o)?(O("QR_CODE",!1),D.value=o):O(o,!1)}}):v.value={max_attempts:1,default_value:"LOCAL"}})});const E=r([""]),j=r([""]),A=r(""),V=r(!1),z=r([]);function oe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}const le=ce(()=>{var e,a,o;return!((e=I.themeInfo)!=null&&e.slo