PageSourceSearch

https://cloud.dict8ion.ai/build/assets/TwoFactorAuthenticationForm.e9738777.js

js dict8ion.ai collected 2026-10-05 14:21:24 UTC 6,174 bytes, 1 lines download raw bytes

1import{u as Q,r as i,a as r,j as e,e as h,b as j,f as L,d as R}from"./app.c9201d71.js";import{c as y}from"./index.0579b088.js";import{A as Y}from"./ActionSection.912aa45f.js";import{D as F}from"./DialogModal.b7f2bb95.js";import{I}from"./InputError.3fea637a.js";import{P as T}from"./PrimaryButton.9bbb1135.js";import{T as D}from"./TextInput.fb9ac2fe.js";import{S as b}from"./SecondaryButton.e0dead7a.js";import{D as q}from"./DangerButton.eef81744.js";import{I as H}from"./InputLabel.bfbaa356.js";import"./SectionTitle.753247b4.js";import"./Modal.59c9d62c.js";import"./transition.acf5e87a.js";function m({title:C="Confirm Password",content:N="For your security, please confirm your password to continue.",button:c="Confirm",onConfirm:p,children:l}){const f=Q(),[x,g]=i.exports.useState(!1),[o,d]=i.exports.useState({password:"",error:"",processing:!1}),t=i.exports.useRef(null);function w(){h.get(f("password.confirmation")).then(a=>{a.data.confirmed?p():(g(!0),setTimeout(()=>{var s;return(s=t.current)==null?void 0:s.focus()},250))})}function v(){d({...o,processing:!0}),h.post(f("password.confirm"),{password:o.password}).then(()=>{u(),setTimeout(()=>p(),250)}).catch(a=>{var s;d({...o,processing:!1,error:a.response.data.errors.password[0]}),(s=t.current)==null||s.focus()})}function u(){g(!1),d({processing:!1,password:"",error:""})}return r("span",{children:[e("span",{onClick:w,children:l}),r(F,{isOpen:x,onClose:u,children:[r(F.Content,{title:C,children:[N,r("div",{className:"mt-4",children:[e(D,{type:"password",className:"mt-1 block w-3/4",placeholder:"Password",value:o.password,onChange:a=>d({...o,password:a.currentTarget.value})}),e(I,{message:o.error,className:"mt-2"})]})]}),r(F.Footer,{children:[e(b,{onClick:u,children:"Cancel"}),e(T,{className:y("ml-2",{"opacity-25":o.processing}),onClick:v,disabled:o.processing,children:c})]})]})]})}function re({requiresConfirmation:C}){var P,k;const N=j(),[c,p]=i.exports.useState(!1),[l,f]=i.exports.useState(!1),[x,g]=i.exports.useState(null),[o,d]=i.exports.useState([]),[t,w]=i.exports.useState(!1),[v,u]=i.exports.useState(null),a=L({code:""}),s=!c&&((k=(P=N.props)==null?void 0:P.user)==null?void 0:k.two_factor_enabled);function M(){p(!0),R.Inertia.post("/user/two-factor-authentication",{},{preserveScroll:!0,onSuccess(){return Promise.all([B(),_(),S()])},onFinish(){p(!1),w(C)}})}function _(){return h.get("/user/two-factor-secret-key").then(n=>{u(n.data.secretKey)})}function K(){a.post("/user/confirmed-two-factor-authentication",{preserveScroll:!0,preserveState:!0,errorBag:"confirmTwoFactorAuthentication",onSuccess:()=>{w(!1),g(null),u(null)}})}function B(){return h.get("/user/two-factor-qr-code").then(n=>{g(n.data.svg)})}function S(){return h.get("/user/two-factor-recovery-codes").then(n=>{d(n.data)})}function E(){h.post("/user/two-factor-recovery-codes").then(()=>{S()})}function A(){f(!0),R.Inertia.delete("/user/two-factor-authentication",{preserveScroll:!0,onSuccess(){f(!1),w(!1)}})}return r(Y,{title:"Two Factor Authentication",description:"Add additional security to your account using two factor authentication.",children:[(()=>s&&!t?e("h3",{className:"text-lg font-medium text-gray-900",children:"You have enabled two factor authentication."}):t?e("h3",{className:"text-lg font-medium text-gray-900",children:"Finish enabling two factor authentication."}):e("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:"You have not enabled two factor authentication."}))(),e("div",{className:"mt-3 max-w-xl text-sm text-gray-600 dark:text-edify-white-gray",children:e("p",{children:"When two factor authentication is enabled, you will be prompted for a secure, random token during authentication. You may use any authenticator App (ie: Google Authenticator, Authy or Passwords (Apple) etc) to retrieve this token from your phone's authenticator application once you have enabled MFA."})}),s||t?r("div",{children:[x?r("div",{children:[e("div",{className:"mt-4 max-w-xl text-sm text-gray-600",children:t?e("p",{className:"font-semibold",children:"To finish enabling two factor authentication, scan the following QR code using your phone's authenticator application or enter the setup key and provide the generated OTP code."}):e("p",{children:"Two factor authentication is now enabled. Scan the following QR code using your phone's authenticator application or enter the setup key."})}),e("div",{className:"mt-4",dangerouslySetInnerHTML:{__html:x||""}}),v&&e("div",{className:"mt-4 max-w-xl text-sm text-gray-600",children:r("p",{className:"font-semibold",children:["Setup Key:"," ",e("span",{dangerouslySetInnerHTML:{__html:v||""}})]})}),t&&r("div",{className:"mt-4",children:[e(H,{htmlFor:"code",value:"Code"}),e(D,{id:"code",type:"text",name:"code",className:"block mt-1 w-1/2",inputMode:"numeric",autoFocus:!0,autoComplete:"one-time-code",value:a.data.code,onChange:n=>a.setData("code",n.currentTarget.value)}),e(I,{message:a.errors.code,className:"mt-2"})]})]}):null,o.length>0&&!t?r("div",{children:[e("div",{className:"mt-4 max-w-xl text-sm text-gray-600",children:e("p",{className:"font-semibold",children:"Store these recovery codes in a secure password manager. They can be used to recover access to your account if your two factor authentication device is lost."})}),e("div",{className:"grid gap-1 max-w-xl mt-4 px-4 py-4 font-mono text-sm bg-gray-100 rounded-lg",children:o.map(n=>e("div",{children:n},n))})]}):null]}):null,e("div",{className:"mt-5",children:s||t?r("div",{children:[t?e(m,{onConfirm:K,children:e(T,{className:y("mr-3",{"opacity-25":c}
1),disabled:c,children:"Confirm"})}):null,o.length>0&&!t?e(m,{onConfirm:E,children:e(b,{className:"mr-3",children:"Regenerate Recovery Codes"})}):null,o.length===0&&!t?e(m,{onConfirm:S,children:e(b,{className:"mr-3",children:"Show Recovery Codes"})}):null,t?e(m,{onConfirm:A,children:e(b,{className:y("mr-3",{"opacity-25":l}),disabled:l,children:"Cancel"})}):e(m,{onConfirm:A,children:e(q,{className:y({"opacity-25":l}),disabled:l,children:"Disable"})})]}):e("div",{children:e(m,{onConfirm:M,children:e(T,{type:"button",className:y({"opacity-25":c}),disabled:c,children:"Enable"})})})})]})}export{re as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.