
/**
 * 由 Fantastic-admin 提供技术支持
 * Powered by Fantastic-admin
 * https://fantastic-admin.github.io
 */

import{_ as U}from"./index.vue_vue_type_script_setup_true_lang-BTce45WY.js";import{d as y,m as C,r as S,a as O,p as n,g as w,c as k,b as e,w as l,h as E,e as _,G as g,j as H,_ as q,k as M}from"./index-nGFMSQGw.js";import{a as L}from"./config-CYXO1pNF.js";const h=_("div",{class:"flex items-center gap-4"},"邮件登录设置",-1),B=_("div",{class:"text-sm/6"},[_("div",null,"邮件设置主要用于发送注册时的激活邮件。"),_("div",null,"是否开启邮箱登录：决定用户是否可以通过邮箱进行登录。"),_("div",null,"是否开启邮箱注册：决定用户是否可以通过邮箱进行注册。"),_("div",null,"SMTP服务器配置，用于发送邮件的 SMTP 相关配置，需自行测试。")],-1),j=y({__name:"email",setup(N){const o=C({noVerifyRegister:"",emailLoginStatus:"",MAILER_HOST:"",MAILER_PORT:"",MAILER_USER:"",MAILER_PASS:"",MAILER_SECURE:""}),A=S({MAILER_HOST:[{required:!0,trigger:"blur",message:"请填写SMTP服务器地址"}],MAILER_PORT:[{required:!0,trigger:"blur",message:"请填写SMTP服务器端口"}],MAILER_USER:[{required:!0,trigger:"blur",message:"请填写SMTP用户名称"}],MAILER_PASS:[{required:!0,trigger:"blur",message:"请填写SMTP用户密码"}],MAILER_SECURE:[{required:!0,trigger:"blur",message:"是否使用SSL"}]}),m=S();async function f(){const r=await L.queryConfig({keys:["noVerifyRegister","emailLoginStatus","MAILER_HOST","MAILER_PORT","MAILER_USER","MAILER_PASS","MAILER_SECURE"]});Object.assign(o,r.data)}function I(){var r;(r=m.value)==null||r.validate(async t=>{if(t){try{await L.setConfig({settings:V(o)}),g.success("变更配置信息成功")}catch{}f()}else g.error("请填写完整信息")})}function V(r){return Object.keys(r).map(t=>({configKey:t,configVal:r[t]}))}return O(()=>{f()}),(r,t)=>{const c=H,x=q,b=U,p=n("el-switch"),R=n("el-tooltip"),u=n("el-form-item"),s=n("el-col"),d=n("el-row"),i=n("el-input"),P=n("el-checkbox"),T=n("el-form"),v=n("el-card");return w(),k("div",null,[e(b,null,{title:l(()=>[h]),content:l(()=>[B]),default:l(()=>[e(x,{text:"",outline:"",onClick:I},{default:l(()=>[e(c,{name:"i-ri:file-text-line"}),E(" 保存设置 ")]),_:1})]),_:1}),e(v,{style:{margin:"20px"}},{default:l(()=>[e(T,{ref_key:"formRef",ref:m,rules:A.value,model:o,"label-width":"190px"},{default:l(()=>[e(d,null,{default:l(()=>[e(s,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"开启邮箱注册/登录",prop:"emailLoginStatus"},{default:l(()=>[e(R,{class:"box-item",effect:"dark",content:"如您启用当前邮箱登录、则用户端可以通过邮箱登录！",placement:"right"},{default:l(()=>[e(p,{modelValue:o.emailLoginStatus,"onUpdate:modelValue":t[0]||(t[0]=a=>o.emailLoginStatus=a),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),e(d,null,{default:l(()=>[e(s,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"关闭注册验证",prop:"noVerifyRegister"},{default:l(()=>[e(R,{class:"box-item",effect:"dark",content:"打开即为关闭注册校验、注册将直接成功、请谨慎开启！",placement:"right"},{default:l(()=>[e(p,{modelValue:o.noVerifyRegister,"onUpdate:modelValue":t[1]||(t[1]=a=>o.noVerifyRegister=a),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1}),e(d,null,{default:l(()=>[e(s,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"SMTP服务器地址",prop:"MAILER_HOST"},{default:l(()=>[e(i,{modelValue:o.MAILER_HOST,"onUpdate:modelValue":t[2]||(t[2]=a=>o.MAILER_HOST=a),placeholder:"示例: smtp.example.com",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(d,null,{default:l(()=>[e(s,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"SMTP服务器端口",prop:"MAILER_PORT"},{default:l(()=>[e(i,{modelValue:o.MAILER_PORT,"onUpdate:modelValue":t[3]||(t[3]=a=>o.MAILER_PORT=a),placeholder:"示例: 465",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(d,null,{default:l(()=>[e(s,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"SMTP用户名称",prop:"MAILER_USER"},{default:l(()=>[e(i,{modelValue:o.MAILER_USER,"onUpdate:modelValue":t[4]||(t[4]=a=>o.MAILER_USER=a),placeholder:"SMTP认证用户名",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(d,null,{default:l(()=>[e(s,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"SMTP用户密码",prop:"MAILER_PASS"},{default:l(()=>[e(i,{modelValue:o.MAILER_PASS,"onUpdate:modelValue":t[5]||(t[5]=a=>o.MAILER_PASS=a),placeholder:"SMTP认证密码",type:"password","show-password":"",clearable:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(d,null,{default:l(()=>[e(s,{xs:24,md:20,lg:15,xl:12},{default:l(()=>[e(u,{label:"邮箱SSL配置",prop:"MAILER_SECURE"},{default:l(()=>[e(P,{modelValue:o.MAILER_SECURE,"onUpdate:modelValue":t[6]||(t[6]=a=>o.MAILER_SECURE=a),"true-label":"1","false-label":"0"},{default:l(()=>[E(" 启用SSL ")]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["rules","model"])]),_:1})])}}});typeof M=="function"&&M(j);export{j as default};
