2 lines
32 KiB
JavaScript
2 lines
32 KiB
JavaScript
|
|
import{aW as L,aZ as $,ba as B,aU as s,bp as G,a$ as r,bq as T,b0 as p,bc as b,b3 as l,b2 as n,br as q,b7 as P,b8 as _,b5 as V,bl as k,bZ as J,bY as z,b_ as H,bm as O,b1 as E,bg as pe,bh as me,bi as ge,dJ as fe,bd as W,be as Z,c7 as ae,bk as D,ci as _e,ce as le,b6 as ve,bj as he,bN as be,cr as we}from"./chat-Cy69_N2w.js";import{a as N}from"./auth-setting-C2gJj09u.js";import{_ as ye,a as Ve,b as $e,c as ke,d as Ue,e as Pe}from"./logo_wechat-CtSPVOnf.js";const Ce={class:"authentication-setting__main main-calc-height"},Ie={class:"form-container p-24"},Se={class:"mr-12"},Ae=L({__name:"LDAP",setup(A){const a=$({id:"",auth_type:"LDAP",config:{ldap_server:"",base_dn:"",password:"",ou:"",ldap_filter:"",ldap_mapping:""},is_active:!0}),v=$(),m=$(!1),f=B({"config.ldap_server":[{required:!0,message:s("views.system.authentication.ldap.serverPlaceholder"),trigger:"blur"}],"config.base_dn":[{required:!0,message:s("views.system.authentication.ldap.bindDNPlaceholder"),trigger:"blur"}],"config.password":[{required:!0,message:s("views.login.loginForm.password.placeholder"),trigger:"blur"}],"config.ou":[{required:!0,message:s("views.system.authentication.ldap.ouPlaceholder"),trigger:"blur"}],"config.ldap_filter":[{required:!0,message:s("views.system.authentication.ldap.ldap_filterPlaceholder"),trigger:"blur"}],"config.ldap_mapping":[{required:!0,message:s("views.system.authentication.ldap.ldap_mappingPlaceholder"),trigger:"blur"}]}),U=async(t,o)=>{t&&await t.validate((c,d)=>{c&&(o?N.postAuthSetting(a.value,m).then(w=>{O(s("views.system.testSuccess"))}):N.putAuthSetting(a.value.auth_type,a.value,m).then(w=>{O(s("common.saveSuccess"))}))})};function i(){N.getAuthSetting(a.value.auth_type,m).then(t=>{t.data&&JSON.stringify(t.data)!=="{}"&&(a.value=t.data,t.data.config.ldap_mapping&&(a.value.config.ldap_mapping=JSON.stringify(JSON.parse(t.data.config.ldap_mapping))))})}return G(()=>{i()}),(t,o)=>{const c=r("el-input"),d=r("el-form-item"),w=r("el-checkbox"),I=r("el-form"),S=r("el-button"),u=r("el-scrollbar"),g=T("hasPermission"),h=T("loading");return p(),b("div",Ce,[l(u,null,{default:n(()=>[q((p(),b("div",Ie,[l(I,{ref_key:"authFormRef",ref:v,rules:f,model:a.value,"label-position":"top","require-asterisk-position":"right"},{default:n(()=>[l(d,{label:t.$t("views.system.authentication.ldap.address"),prop:"config.ldap_server"},{default:n(()=>[l(c,{modelValue:a.value.config.ldap_server,"onUpdate:modelValue":o[0]||(o[0]=e=>a.value.config.ldap_server=e),placeholder:t.$t("views.system.authentication.ldap.serverPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(d,{label:t.$t("views.system.authentication.ldap.bindDN"),prop:"config.base_dn"},{default:n(()=>[l(c,{modelValue:a.value.config.base_dn,"onUpdate:modelValue":o[1]||(o[1]=e=>a.value.config.base_dn=e),placeholder:t.$t("views.system.authentication.ldap.bindDNPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(d,{label:t.$t("views.system.password"),prop:"config.password"},{default:n(()=>[l(c,{modelValue:a.value.config.password,"onUpdate:modelValue":o[2]||(o[2]=e=>a.value.config.password=e),placeholder:t.$t("views.login.loginForm.password.placeholder"),"show-password":""},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(d,{label:t.$t("views.system.authentication.ldap.ou"),prop:"config.ou"},{default:n(()=>[l(c,{modelValue:a.value.config.ou,"onUpdate:modelValue":o[3]||(o[3]=e=>a.value.config.ou=e),placeholder:t.$t("views.system.authentication.ldap.ouPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(d,{label:t.$t("views.system.authentication.ldap.ldap_filter"),prop:"config.ldap_filter"},{default:n(()=>[l(c,{modelValue:a.value.config.ldap_filter,"onUpdate:modelValue":o[4]||(o[4]=e=>a.value.config.ldap_filter=e),placeholder:t.$t("views.system.authentication.ldap.ldap_filterPlaceholder")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),l(d,{label:t.$t("views.system.authentication.ldap.ldap_mapping"),prop:"config.ldap_mapping"},{default:n(()=>[l(c,{modelValue:a.value.config.ldap_mapping,"onUpdate:modelValue":o[5]||(o[5]=e=
|