import{o,c as u,w as d,a as e,u as s,g as l,f as r,i as p,h as c,t as f,b as m}from"./app-BYcXwl4U.js";import{i as _,c as h}from"./app-a6cKceqE.js";import{D as k}from"./app-7GBSHA5C.js";import{_ as x}from"./app-VC1SYszA.js";import"./app-yF7sElvF.js";import"./app-CqkleIqs.js";function b(){const{utils:n,Tea:t}=_(this);this.enable=function(){n.confirm("确定要启用多因子认证吗？",function(){this.$post(".enable").success(function(){n.reload()})})},this.disable=function(){n.confirm("确定要停用多因子认证吗？",function(){this.$post(".disable").success(function(){n.reload()})})},this.updateOtp=function(){n.confirm("确定要重新生成OTP密钥吗？",function(){this.$post(".updateOtp").post().success(function(){n.successRefresh("已重新生成OTP")})})}}const O=e("td",{class:"title"},"状态",-1),y={key:0,class:"green"},C={key:1,class:"disabled"},T=e("p",{class:"comment"},"启用后，用户每次登录时需要输入动态密码。",-1),g={key:0},w=e("td",null,"认证二维码",-1),$=e("td",null,[e("img",{src:"/settings/mfa/otpQrcode",alt:""}),e("p",{class:"comment"},[e("a",{href:"/settings/mfa/otpQrcode?download=true",class:"link"},"[下载]"),r("   可以通过二维码快速添加OTP认证信息到认证App中。")])],-1),v=[w,$],B={key:1},N=e("td",null,"密钥",-1),M={__name:"index",setup(n){const t=h(new b);return(P,i)=>(o(),u(k,null,{default:d(()=>[e("tbody",null,[e("tr",null,[O,e("td",null,[s(t).otp!=null&&s(t).otp.isOn?(o(),l("span",y,"已启用OTP认证")):(o(),l("span",C,"未启用")),r("     "),s(t).otp!=null&&s(t).otp.isOn?(o(),l("a",{key:2,href:"",onClick:i[0]||(i[0]=p((...a)=>s(t).disable&&s(t).disable(...a),["prevent"])),class:"link text-sm"},"[停用]")):c("",!0),s(t).otp==null||!s(t).otp.isOn?(o(),l("a",{key:3,href:"",onClick:i[1]||(i[1]=p((...a)=>s(t).enable&&s(t).enable(...a),["prevent"])),class:"link text-sm"},"[启用]")):c("",!0),T])]),s(t).otp!=null&&s(t).otp.isOn?(o(),l("tr",g,v)):c("",!0),s(t).otp!=null&&s(t).otp.isOn?(o(),l("tr",B,[N,e("td",null,[r(f(s(t).otp.params.secret)+" ",1),m(x,{text:s(t).otp.params.secret},null,8,["text"]),r("   "),e("a",{href:"",onClick:i[2]||(i[2]=p(a=>s(t).updateOtp(),["prevent"]))},"[重新生成]")])])):c("",!0)])]),_:1}))}};export{M as default};
