import{r}from"./app.79e1f42d.js";import n from"./Button.f17dffc9.js";import s from"./Input.9d199ebb.js";import a from"./FormInput.7debc7c5.js";import{n as i}from"./plugin-vue2_normalizer.000ba15c.js";import"./FormGroup.efd02a6a.js";import"./Label.9d0d3ee0.js";import"./ErrorText.b141a597.js";import"./HelperText.14a7ed0b.js";import"./IconClipboard.8551be1b.js";import"./IconKey.455a255f.js";const c={components:{FormInput:a,Input:s,Button:n},props:{secret:Object,recoveryCodes:Array,enabled:Boolean},data(){return{sending:!1,form:{code:""}}},methods:{enable2FA(){r.Inertia.put(this.route("profile.security.two-factor-authentication.create"))},confirm2FA(){r.Inertia.patch(this.route("profile.security.two-factor-authentication.confirm"),this.form,{onStart:()=>this.sending=!0,onFinish:()=>this.sending=!1})},regenerateRecoveryCodes(){r.Inertia.patch(this.route("profile.security.two-factor-authentication.regenerate-recovery-codes"),{},{onStart:()=>this.sending=!0,onFinish:()=>this.sending=!1})},disable2FA(){r.Inertia.delete(this.route("profile.security.two-factor-authentication.destroy"),{},{onStart:()=>this.sending=!0,onFinish:()=>this.sending=!1})}}};var u=function(){var e=this,t=e._self._c;return e.secret.string?e.enabled?t("div",{staticClass:"space-y-4"},[e.recoveryCodes.length!==0?t("div",{staticClass:"space-y-4"},[t("div",[t("strong",{},[e._v(e._s(e.__("Recovery codes")))]),t("p",[e._v(e._s(e.__("Please store your recovery codes safely. When you lose access to both your Authenticator app and recovery codes, you might become locked out of your account forever.")))]),t("strong",{staticClass:"block mt-2"},[e._v(e._s(e.__("Your recovery codes will only be displayed once.")))])]),t("ul",{staticClass:"bg-gray-50 rounded-md font-mono px-4 py-3"},e._l(e.recoveryCodes,function(o){return t("li",{key:o.code,domProps:{textContent:e._s(o.code)}})}),0)]):e._e(),t("div",{staticClass:"mt-2 flex gap-x-4"},[t("form",{on:{submit:function(o){return o.preventDefault(),e.regenerateRecoveryCodes.apply(null,arguments)}}},[t("Button",{attrs:{loading:e.sending}},[e._v(" "+e._s(e.__("Regenerate recovery codes"))+" ")])],1),t("form",{on:{submit:function(o){return o.preventDefault(),e.disable2FA.apply(null,arguments)}}},[t("Button",{attrs:{variant:"danger",loading:e.sending}},[e._v(" "+e._s(e.__("Disable two factor authentication"))+" ")])],1)])]):t("div",[t("p",[e._v(e._s(e.__("Please scan the QR-code with your authentication app to confirm. ")))]),t("div",{domProps:{innerHTML:e._s(e.secret.qr_code)}}),t("form",{staticClass:"space-y-4",on:{submit:function(o){return o.preventDefault(),e.confirm2FA.apply(null,arguments)}}},[t("FormInput",{attrs:{label:e.__("Enter the confirmation code"),autofocus:!0,errors:e.$page.props.errors.code,required:""},model:{value:e.form.code,callback:function(o){e.$set(e.form,"code",o)},expression:"form.code"}}),t("Button",{attrs:{loading:e.sending}},[e._v(" "+e._s(e.__("Confirm code"))+" ")])],1)]):t("div",[t("form",{on:{submit:function(o){return o.preventDefault(),e.enable2FA.apply(null,arguments)}}},[t("Button",{attrs:{loading:e.sending}},[e._v(" "+e._s(e.__("Enable two-factor authentication"))+" ")])],1)])},l=[],d=i(c,u,l,!1,null,null,null,null);const A=d.exports;export{A as default};
