3 lines
10 KiB
JavaScript
3 lines
10 KiB
JavaScript
|
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dingtalkQrCode-fxVVh1Jk.js","./logo_dingtalk-CyDPr22R.js","./chat-DMgUwcr0.js","./chat-DvX_YSBC.css","./dingtalkQrCode-CulsC8mV.css","./larkQrCode-DIXPhZCL.js","./logo_lark-DULIW3z6.js","./wecomQrCode-BNoOTTZI.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 f,bf as x,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 m,aJ as Q,cu as fe,aI as _,aK as H,bn as J,bx as me,co as W,cv as ge,c6 as ve,cw as he,c7 as _e,ce as be}from"./chat-DMgUwcr0.js";import{_ as ye,a as we,f as F,d as ke}from"./index-AXnj4ELe.js";import{L as xe,a as Ce}from"./LoginContainer-YZEMu4hX.js";import{a as X}from"./auth-setting-CYdtPDgn.js";import{C as Ae}from"./index-BBf7HcEJ.js";const Ie={key:0,class:"text-center mt-16"},Le=Y({__name:"QrCodeTab",props:{tabs:{},defaultTab:{}},setup(B){const{login:C}=Z(),p=B,u=r(""),I=r([]),S=r({app_key:"",app_secret:""});async function c(){try{return await C.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:f(()=>[(i(!0),x(q,null,te(B.tabs,k=>(i(),L(D,{key:k.key,label:k.value,name:k.key},{default:f(()=>[k.key===u.value?(i(),x("div",Ie,[(i(),L(se(re(()=>ye(Object.assign({"./dingtalkQrCode.vue":()=>M(()=>import("./dingtalkQrCode-fxVVh1Jk.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),"./larkQrCode.vue":()=>M(()=>import("./larkQrCode-DIXPhZCL.js"),__vite__mapDeps([5,6,2,3]),import.meta.url),"./wecomQrCode.vue":()=>M(()=>import("./wecomQrCode-BNoOTTZI.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={style:{display:"flex","align-items":"center","justify-content":"center"}},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},Be={key:3,class:"login-gradient-divider lighter mt-24"},Ue={class:"text-center mt-16"},Me=Y({__name:"index",setup(B){const C=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",C.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"),C.push({name:"home"})}).catch(()=>{const h=s.value.username;c.value=!1,U(h)})}})};function U(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){U(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=c
|