https://www.ai-toolbox.co/_next/static/chunks/app/(site)/dashboard/settings/page-48ac85a7e80c62e5.js
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6178],{992:(e,s,a)=>{"use strict";a.d(s,{default:()=>f});var t=a(95155),n=a(31244),l=a(7902),i=a(51357),d=a(5126),r=a(56461),c=a(54229),o=a(39734),h=a(97944),u=a(12115),_=a(9339);let m=(0,_.createServerReference)("00520513eac55fdf1e6f94785a52b34bcb6b4a4701",_.callServer,void 0,_.findSourceMapURL,"teams2FASetup");var g=a(93089);let p=(0,_.createServerReference)("4021d01499a1b3a0497187330a3a61df152bdf680b",_.callServer,void 0,_.findSourceMapURL,"teams2FAVerify"),S=(0,_.createServerReference)("60819ce335a533657fdd79fe6785eaab63e4df31f3",_.callServer,void 0,_.findSourceMapURL,"teams2FADisable"),x=(0,_.createServerReference)("40c5f80709b3043df4abf2628781cc178f62d3b0dd",_.callServer,void 0,_.findSourceMapURL,"teams2FARegenerateBackupCodes");var b=a(8300);a(95959);let f=()=>{let{passwordExpanded:e,togglePasswordExpanded:s,oldPassword:a,setOldPassword:_,newPassword:f,setNewPassword:j,confirmPassword:v,setConfirmPassword:N,showOldPassword:w,setShowOldPassword:y,showNewPassword:C,setShowNewPassword:k,showConfirmPassword:A,setShowConfirmPassword:P,passwordLoading:F,passwordError:T,passwordSuccess:R,passwordRequirements:B,passwordsMatch:z,canSubmitPassword:D,handleChangePassword:L,twoFAState:E,qrCode:q,manualKey:H,totpCode:I,setTotpCode:V,backupCodes:M,twoFALoading:O,twoFAError:U,copiedManualKey:W,copiedBackupCodes:K,handleEnable2FA:Y,handleProceedToVerify:G,handleVerify2FA:Q,handleBackupCodesSaved:Z,handleCancelSetup:$,handleCopyManualKey:J,handleCopyBackupCodes:X,showDisableModal:ee,disablePassword:es,setDisablePassword:ea,disableTotpCode:et,setDisableTotpCode:en,disableLoading:el,disableError:ei,handleOpenDisableModal:ed,handleCloseDisableModal:er,handleConfirmDisable2FA:ec,showRegenModal:eo,regenPassword:eh,setRegenPassword:eu,regenLoading:e_,regenError:em,handleOpenRegenModal:eg,handleCloseRegenModal:ep,handleConfirmRegenBackupCodes:eS}=(()=>{let[e,s]=(0,u.useState)(!1),[a,t]=(0,u.useState)(""),[n,l]=(0,u.useState)(""),[i,d]=(0,u.useState)(""),[r,c]=(0,u.useState)(!1),[o,h]=(0,u.useState)(!1),[_,f]=(0,u.useState)(!1),[j,v]=(0,u.useState)(!1),[N,w]=(0,u.useState)(null),[y,C]=(0,u.useState)(!1),[k,A]=(0,u.useState)("loading"),[P,F]=(0,u.useState)(""),[T,R]=(0,u.useState)(""),[B,z]=(0,u.useState)(""),[D,L]=(0,u.useState)([]),[E,q]=(0,u.useState)(!1),[H,I]=(0,u.useState)(null),[V,M]=(0,u.useState)(!1),[O,U]=(0,u.useState)(!1),[W,K]=(0,u.useState)(!1),[Y,G]=(0,u.useState)(""),[Q,Z]=(0,u.useState)(""),[$,J]=(0,u.useState)(!1),[X,ee]=(0,u.useState)(null),[es,ea]=(0,u.useState)(!1),[et,en]=(0,u.useState)(""),[el,ei]=(0,u.useState)(!1),[ed,er]=(0,u.useState)(null),ec=(0,u.useRef)(null),eo=(0,u.useRef)(null),eh=(0,u.useRef)(null);(0,u.useEffect)(()=>()=>{ec.current&&clearTimeout(ec.current),eo.current&&clearTimeout(eo.current),eh.current&&clearTimeout(eh.current)},[]),(0,u.useEffect)(()=>{window.gtag&&window.gtag("event","dashboard_view",{section:"settings"})},[]),(0,u.useEffect)(()=>{let e=!1;return(async()=>{let s=await m();e||(s.success?(F(s.qr_code||""),R(s.manual_key||""),A("disabled")):"already_enabled"===s.error_code?A("enabled"):A("disabled"))})(),()=>{e=!0}},[]);let eu={minLength:n.length>=8,uppercase:/[A-Z]/.test(n),lowercase:/[a-z]/.test(n),number:/[0-9]/.test(n),specialChar:/[^A-Za-z0-9]/.test(n)},e_=Object.values(eu).every(Boolean),em=n===i&&i.length>0,eg=a.length>0&&e_&&em&&!j,ep=(0,u.useCallback)(()=>{s(e=>!e),w(null),C(!1)},[]),eS=(0,u.useCallback)(async()=>{if(!eg)return;v(!0),w(null),C(!1);let e=await (0,g.Y)(a,n,i);e.success?(e.token&&await (0,b.D)(e.token),C(!0),t(""),l(""),d(""),c(!1),h(!1),f(!1),eh.current=setTimeout(()=>{C(!1)},5e3)):w({invalid_old_password:"Current password is incorrect.",password_same_as_old:"New password must be different from your current password.",weak_password:e.reason||"Password does not meet the requirements.",missing_fields:"Please fill in all password fields.",passwords_do_not_match:"New password and confirmation do not match.",change_password_failed:"Failed to change password. Please try again."}[e.error||""]||e.error||"An unexpected error occurred."),v(!1)},[eg,a,n,i]),ex=(0,u.useCallback)(async()=>{q(!0),I(null);let e=await m();e.success?(F(e.qr_code||""),R(e.manual_key||""),A("setup-qr")):"already_enabled"===e.error?A("enabled"):I(e.error||"Failed to start 2FA setup."),q(!1)},[]),eb=(0,u.useCallback)(()=>{z(""),I(null),A("setup-verify")},[]),ef=(0,u.useCallback)(async()=>
1{if(6!==B.length&&8!==B.length)return;q(!0),I(null);let e=await p(B);e.success?(L(e.backup_codes||[]),A("backup-codes"),z("")):I("invalid_code"===e.error?"Invalid verification code. Please try again.":e.error||"Verification failed."),q(!1)},[B]),ej=(0,u.useCallback)(()=>{L([]),A("enabled")},[]),ev=(0,u.useCallback)(()=>{A("disabled"),F(""),R(""),z(""),I(null)},[]),eN=(0,u.useCallback)(async e=>{try{if(navigator.clipboard&&navigator.clipboard.writeText)return await navigator.clipboard.writeText(e),!0;let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();let a=document.execCommand("copy");return document.body.removeChild(s),a}catch{return!1}},[]),ew=(0,u.useCallback)(async()=>{await eN(T)&&(M(!0),ec.current&&clearTimeout(ec.current),ec.current=setTimeout(()=>M(!1),2e3))},[T,eN]),ey=(0,u.useCallback)(async()=>{let e=D.join("\n");await eN(e)&&(U(!0),eo.current&&clearTimeout(eo.current),eo.current=setTimeout(()=>U(!1),2e3))},[D,eN]),eC=(0,u.useCallback)(()=>{G(""),Z(""),ee(null),K(!0)},[]),ek=(0,u.useCallback)(()=>{K(!1),ee(null)},[]),eA=(0,u.useCallback)(async()=>{if(!Y||6!==Q.length&&8!==Q.length)return;J(!0),ee(null);let e=await S(Y,Q);e.success?(K(!1),A("disabled")):ee({invalid_password:"Incorrect password.",invalid_code:"Invalid verification code.",disable_failed:"Failed to disable 2FA. Please try again."}[e.error||""]||e.error||"An unexpected error occurred."),J(!1)},[Y,Q]),eP=(0,u.useCallback)(()=>{en(""),er(null),ea(!0)},[]),eF=(0,u.useCallback)(()=>{ea(!1),er(null)},[]),eT=(0,u.useCallback)(async()=>{if(!et)return;ei(!0),er(null);let e=await x(et);e.success?(L(e.backup_codes||[]),ea(!1),A("backup-codes")):er({invalid_password:"Incorrect password.",regenerate_failed:"Failed to regenerate backup codes. Please try again."}[e.error||""]||e.error||"An unexpected error occurred."),ei(!1)},[et]);return{passwordExpanded:e,togglePasswordExpanded:ep,oldPassword:a,setOldPassword:t,newPassword:n,setNewPassword:l,confirmPassword:i,setConfirmPassword:d,showOldPassword:r,setShowOldPassword:c,showNewPassword:o,setShowNewPassword:h,showConfirmPassword:_,setShowConfirmPassword:f,passwordLoading:j,passwordError:N,passwordSuccess:y,passwordRequirements:eu,allRequirementsMet:e_,passwordsMatch:em,canSubmitPassword:eg,handleChangePassword:eS,twoFAState:k,qrCode:P,manualKey:T,totpCode:B,setTotpCode:z,backupCodes:D,twoFALoading:E,twoFAError:H,copiedManualKey:V,copiedBackupCodes:O,handleEnable2FA:ex,handleProceedToVerify:eb,handleVerify2FA:ef,handleBackupCodesSaved:ej,handleCancelSetup:ev,handleCopyManualKey:ew,handleCopyBackupCodes:ey,showDisableModal:W,disablePassword:Y,setDisablePassword:G,disableTotpCode:Q,setDisableTotpCode:Z,disableLoading:$,disableError:X,handleOpenDisableModal:eC,handleCloseDisableModal:ek,handleConfirmDisable2FA:eA,showRegenModal:es,regenPassword:et,setRegenPassword:en,regenLoading:el,regenError:ed,handleOpenRegenModal:eP,handleCloseRegenModal:eF,handleConfirmRegenBackupCodes:eT}})();return(0,t.jsxs)("div",{className:"dashSettings",children:[(0,t.jsx)("h1",{className:"dashSettings__title",children:"Settings"}),(0,t.jsxs)("div",{className:"dashSettings__card",children:[(0,t.jsxs)("button",{className:"dashSettings__cardHeader",onClick:s,"aria-expanded":e,type:"button",children:[(0,t.jsxs)("div",{className:"dashSettings__cardHeaderLeft",children:[(0,t.jsx)(n.A,{className:"dashSettings__cardIcon"}),(0,t.jsx)("h2",{className:"dashSettings__cardTitle",children:"Change Password"})]}),(0,t.jsx)(o.A,{className:`dashSettings__expandIcon ${e?"dashSettings__expandIcon--open":""}`})]}),e&&(0,t.jsxs)("div",{className:"dashSettings__cardBody",children:[R&&(0,t.jsxs)("div",{className:"dashSettings__alert dashSettings__alert--success",children:[(0,t.jsx)(r.A,{fontSize:"small"}),(0,t.jsx)("span",{children:"Password updated successfully."})]}),T&&(0,t.jsx)("div",{className:"dashSettings__alert dashSettings__alert--error",children:(0,t.jsx)("span",{children:T})}),(0,t.jsxs)("form",{className:"dashSettings__form",onSubmit:e=>{e.preventDefault(),L()},children:[(0,t.jsxs)("div",{className:"dashSettings__field",children:[(0,t.jsx)("label",{className:"dashSettings__label",htmlFor:"oldPassword",children:"Current Password"}),(0,t.jsxs)("div",{className:"dashSettings__inputWrap",children:[(0,t.jsx)("input",{id:"oldPassword",type:w?"text":"password",className:"dashSettings__input",value:a,onChange:e=>_(e.target.value),autoComplete:"current-password"}),(0,t.jsx)("button",{type:"button",className:"dashSettings__toggleVis",onClick:()=>y(e=>!e),"aria-label":w?"Hide current password":"Show current password",children:w?(0,t.jsx)(d.A,{fontSize:"small"}):(0,t.jsx)(i.A,{fontSize:"small"})})]})]}),(0,t.jsxs)("div",{className:"dashSettings__field",children:[(0,t.jsx)("label",{className:"dashSettings__label",htmlFor:"newPassword",children:"New Password"}),(0,t.jsxs)("div",{className:"dashSettings__inputWrap",children:[(0,t.jsx)("input",{id:"newPassword",type:C?"text":"password",className:"dashSettings__input",value:f,onChange:e=>j(e.target.value),autoComplete:"new-password"}),(0,t.jsx)("button",{type:"button",className:"dashSettings__toggleVis",onClick:()=>k(e=>!e),"aria-label":C?"Hide new password":"Show new password",children:C?(0,t.jsx)(d.A,{fontSize:"small"}):(0,t.jsx)(i.A,{fontSize:"small"})})]})]}),f.length>0&&(0,t.jsx)("ul",{className:"dashSettings__requirements",children:[{key:"minLength",label:"At least 8 characters"},{key:"uppercase",label:"One uppercase letter"},{key:"lowercase",label:"One lowercase letter"},{key:"number",label:"One number"},{key:"specialChar",label:"One special character"}].map(({key:e,label:s})=>(0,t.jsxs)("li",{className:`dashSettings__requirement ${B[e]?"dashSettings__requirement--met":""}`,children:[(0,t.jsx)(r.A,{fontSize:"small"}),(0,t.jsx)("span",{children:s})]},e))}),(0,t.jsxs)("div",{className:"dashSettings__field",children:[(0,t.jsx)("label",{className:"dashSettings__label",htmlFor:"confirmPassword",children:"Confirm New Password"}),(0,t.jsxs)("div",{className:"dashSettings__inputWrap",children:[(0,t.jsx)("input",{id:"confirmPassword",type:A?"text":"password",className:"dashSettings__input",value:v,onCh
1ange:e=>N(e.target.value),autoComplete:"new-password"}),(0,t.jsx)("button",{type:"button",className:"dashSettings__toggleVis",onClick:()=>P(e=>!e),"aria-label":A?"Hide confirm password":"Show confirm password",children:A?(0,t.jsx)(d.A,{fontSize:"small"}):(0,t.jsx)(i.A,{fontSize:"small"})})]}),v.length>0&&!z&&(0,t.jsx)("span",{className:"dashSettings__fieldHint dashSettings__fieldHint--error",children:"Passwords do not match."})]}),(0,t.jsx)("button",{type:"submit",className:"dashSettings__submitBtn",disabled:!D,children:F?"Updating...":"Update Password"})]})]})]}),(0,t.jsxs)("div",{className:"dashSettings__card",children:[(0,t.jsxs)("div",{className:"dashSettings__cardHeader dashSettings__cardHeader--static",children:[(0,t.jsxs)("div",{className:"dashSettings__cardHeaderLeft",children:[(0,t.jsx)(l.A,{className:"dashSettings__cardIcon"}),(0,t.jsx)("h2",{className:"dashSettings__cardTitle",children:"Two-Factor Authentication"})]}),"enabled"===E&&(0,t.jsx)("span",{className:"dashSettings__badge dashSettings__badge--success",children:"2FA Enabled"})]}),(0,t.jsxs)("div",{className:"dashSettings__cardBody",children:[U&&(0,t.jsx)("div",{className:"dashSettings__alert dashSettings__alert--error",children:(0,t.jsx)("span",{children:U})}),"loading"===E&&(0,t.jsx)("div",{className:"dashSettings__2faLoading",children:"Loading..."}),"disabled"===E&&(0,t.jsxs)("div",{className:"dashSettings__2faDisabled",children:[(0,t.jsx)("p",{className:"dashSettings__2faDesc",children:"Add an extra layer of security to your account. When enabled, you will need to enter a verification code from your authenticator app each time you sign in."}),(0,t.jsx)("button",{className:"dashSettings__submitBtn",onClick:Y,disabled:O,children:O?"Setting up...":"Enable 2FA"})]}),"setup-qr"===E&&(0,t.jsxs)("div",{className:"dashSettings__2faSetup",children:[(0,t.jsx)("p",{className:"dashSettings__2faDesc",children:"Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)"}),(0,t.jsx)("div",{className:"dashSettings__qrWrap",children:(0,t.jsx)("img",{src:q,alt:"2FA QR Code",className:"dashSettings__qrImage",width:200,height:200})}),(0,t.jsxs)("div",{className:"dashSettings__manualKey",children:[(0,t.jsx)("span",{className:"dashSettings__manualKeyLabel",children:"Or enter this key manually:"}),(0,t.jsxs)("div",{className:"dashSettings__manualKeyRow",children:[(0,t.jsx)("code",{className:"dashSettings__manualKeyCode",children:H}),(0,t.jsx)("button",{type:"button",className:"dashSettings__copyBtn",onClick:J,"aria-label":"Copy manual key",children:W?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.A,{fontSize:"small"})," Copied!"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.A,{fontSize:"small"})," Copy"]})})]})]}),(0,t.jsxs)("div",{className:"dashSettings__2faActions",children:[(0,t.jsx)("button",{className:"dashSettings__submitBtn",onClick:G,children:"Next"}),(0,t.jsx)("button",{className:"dashSettings__cancelBtn",onClick:$,children:"Cancel"})]})]}),"setup-verify"===E&&(0,t.jsxs)("div",{className:"dashSettings__2faVerify",children:[(0,t.jsx)("p",{className:"dashSettings__2faDesc",children:"Enter the 6-digit verification code from your authenticator app to complete setup."}),(0,t.jsxs)("div",{className:"dashSettings__field",children:[(0,t.jsx)("label",{className:"dashSettings__label",htmlFor:"totpCode",children:"Verification Code"}),(0,t.jsx)("input",{id:"totpCode",type:"text",inputMode:"numeric",pattern:"[0-9]*",maxLength:6,className:"dashSettings__input dashSettings__input--totp",value:I,onChange:e=>{V(e.target.value.replace(/\D/g,""))},autoComplete:"one-time-code",placeholder:"000000"})]}),(0,t.jsxs)("div",{className:"dashSettings__2faActions",children:[(0,t.jsx)("button",{className:"dashSettings__submitBtn",onClick:Q,disabled:6!==I.length||O,children:O?"Verifying...":"Verify & Enable"}),(0,t.jsx)("button",{className:"dashSettings__cancelBtn",onClick:$,children:"Cancel"})]})]}),"backup-codes"===E&&(0,t.jsxs)("div",{className:"dashSettings__backupCodes",children:[(0,t.jsxs)("div",{className:"dashSettings__alert dashSettings__alert--warning",children:[(0,t.jsx)(h.A,{fontSize:"small"}),(0,t.jsx)("span",{children:"Save these codes in a safe place. They cannot be shown again."})]}
1),(0,t.jsx)("div",{className:"dashSettings__codesGrid",children:M.map((e,s)=>(0,t.jsx)("code",{className:"dashSettings__code",children:e},s))}),(0,t.jsxs)("div",{className:"dashSettings__2faActions",children:[(0,t.jsx)("button",{className:"dashSettings__copyBtn dashSettings__copyBtn--wide",onClick:X,children:K?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.A,{fontSize:"small"})," Copied!"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.A,{fontSize:"small"})," Copy All"]})}),(0,t.jsx)("button",{className:"dashSettings__submitBtn",onClick:Z,children:"I've saved my codes"})]})]}),"enabled"===E&&(0,t.jsxs)("div",{className:"dashSettings__2faEnabled",children:[(0,t.jsx)("p",{className:"dashSettings__2faDesc",children:"Two-factor authentication is active. Your account is protected with an additional layer of security."}),(0,t.jsxs)("div",{className:"dashSettings__2faActions",children:[(0,t.jsx)("button",{className:"dashSettings__outlineBtn",onClick:eg,children:"Regenerate Backup Codes"}),(0,t.jsx)("button",{className:"dashSettings__dangerBtn",onClick:ed,children:"Disable 2FA"})]})]})]})]}),ee&&(0,t.jsx)("div",{className:"dashSettings__overlay",onClick:er,children:(0,t.jsxs)("div",{className:"dashSettings__modal",onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("h3",{className:"dashSettings__modalTitle",children:"Disable Two-Factor Authentication"}),(0,t.jsx)("p",{className:"dashSettings__modalText",children:"This will remove the extra layer of security from your account. Enter your password and a verification code to confirm."}),ei&&(0,t.jsx)("div",{className:"dashSettings__alert dashSettings__alert--error",children:(0,t.jsx)("span",{children:ei})}),(0,t.jsxs)("div",{className:"dashSettings__field",children:[(0,t.jsx)("label",{className:"dashSettings__label",htmlFor:"disablePassword",children:"Password"}),(0,t.jsx)("input",{id:"disablePassword",type:"password",className:"dashSettings__input",value:es,onChange:e=>ea(e.target.value),autoComplete:"current-password"})]}),(0,t.jsxs)("div",{className:"dashSettings__field",children:[(0,t.jsx)("label",{className:"dashSettings__label",htmlFor:"disableTotpCode",children:"Verification Code"}),(0,t.jsx)("input",{id:"disableTotpCode",type:"text",inputMode:"numeric",pattern:"[0-9]*",maxLength:6,className:"dashSettings__input dashSettings__input--totp",value:et,onChange:e=>{en(e.target.value.replace(/\D/g,""))},autoComplete:"one-time-code",placeholder:"000000"})]}),(0,t.jsxs)("div",{className:"dashSettings__modalActions",children:[(0,t.jsx)("button",{className:"dashSettings__dangerBtn",onClick:ec,disabled:!es||6!==et.length&&8!==et.length||el,children:el?"Disabling...":"Disable 2FA"}),(0,t.jsx)("button",{className:"dashSettings__cancelBtn",onClick:er,disabled:el,children:"Cancel"})]})]})}),eo&&(0,t.jsx)("div",{className:"dashSettings__overlay",onClick:ep,children:(0,t.jsxs)("div",{className:"dashSettings__modal",onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("h3",{className:"dashSettings__modalTitle",children:"Regenerate Backup Codes"}),(0,t.jsx)("p",{className:"dashSettings__modalText",children:"This will invalidate your existing backup codes and generate new ones. Enter your password to confirm."}),em&&(0,t.jsx)("div",{className:"dashSettings__alert dashSettings__alert--error",children:(0,t.jsx)("span",{children:em})}),(0,t.jsxs)("div",{className:"dashSettings__field",children:[(0,t.jsx)("label",{className:"dashSettings__label",htmlFor:"regenPassword",children:"Password"}),(0,t.jsx)("input",{id:"regenPassword",type:"password",className:"dashSettings__input",value:eh,onChange:e=>eu(e.target.value),autoComplete:"current-password"})]}),(0,t.jsxs)("div",{className:"dashSettings__modalActions",children:[(0,t.jsx)("button",{className:"dashSettings__submitBtn",onClick:eS,disabled:!eh||e_,children:e_?"Regenerating...":"Regenerate Codes"}),(0,t.jsx)("button",{className:"dashSettings__cancelBtn",onClick:ep,disabled:e_,children:"Cancel"})]})]})})]})}},6244:(e,s,a)=>{Promise.resolve().then(a.bind(a,992))},8300:(e,s,a)=>{"use strict";a.d(s,{D:()=>n});var t=a(9339);let n=(0,t.createServerReference)("401bc516fcafe5dd3b8c747819ec8b1ef569d159d5",t.callServer,void 0,t.findSourceMapURL,"s
1aveTeamsToken")},93089:(e,s,a)=>{"use strict";a.d(s,{Y:()=>n});var t=a(9339);let n=(0,t.createServerReference)("70cda4a4c6517d2e8d41c3edd32846689d8471773d",t.callServer,void 0,t.findSourceMapURL,"teamsChangePassword")},95959:()=>{}},e=>{e.O(0,[6192,5772,906,8441,5254,7358],()=>e(e.s=6244)),_N_E=e.O()}]);
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.