PageSourceSearch

https://omni.karmaflow.ai/assets/UserSettingsPage-BOY8Rr1j.js

js karmaflow.ai collected 2026-10-05 12:08:09 UTC 13,302 bytes, 6 lines download raw bytes

1import{k as X,c as G,l as R,r as t,j as e,C as z,e as W,S as g,d as Y,O as L,L as u,a1 as J,o as P,X as K,b as j}from"./index-DCEGk7me.js";import{S as Q}from"./save-YBVRd2xg.js";import{I as Z}from"./info-bZjkVAYk.js";/**
2 * @license lucide-react v0.469.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const _=X("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);function ae(){const{user:l,fetchUser:E}=G(),{theme:H,setTheme:T}=R(),[i,b]=t.useState({firstName:"",lastName:"",email:"",password:""}),[N,v]=t.useState(""),[y,h]=t.useState(""),[w,k]=t.useState(!1),[S,o]=t.useState(null),[I,O]=t.useState(!0),[B,d]=t.useState(!1),[p,C]=t.useState(""),[F,f]=t.useState(""),[n,A]=t.useState(!1);t.useEffect(()=>{l&&b({firstName:l.firstName||"",lastName:l.lastName||"",email:l.email||"",password:""})},[l]),t.useEffect(()=>{async function s(){try{const{data:a}=await j.get("/auth/2fa/status");a.eligible===!1?o("sso"):a.enabled?o("enabled"):o("disabled")}catch{o("disabled")}finally{O(!1)}}s()},[]);function m(s){return a=>b(r=>({...r,[s]:a.target.value}))}async function q(s){var a,r,x,D,M;s.preventDefault(),v(""),h(""),k(!0);try{const{data:c}=await j.post("/api/auth/profile",i);h("Settings saved successfully."),b({firstName:((a=c.user)==null?void 0:a.firstName)||"",lastName:((r=c.user)==null?void 0:r.lastName)||"",email:((x=c.user)==null?void 0:x.email)||"",password:""}),await E()}catch(c){v(((M=(D=c.response)==null?void 0:D.data)==null?void 0:M.message)||"Failed to save settings.")}finally{k(!1)}}function U(){C(""),f(""),d(!0)}async function V(s){var a,r;s.preventDefault(),f(""),A(!0);try{await j.post("/auth/2fa/disable",{password:p}),o("disabled"),d(!1),h("Two-factor authentication has been disabled.")}catch(x){f(((r=(a=x.response)==null?void 0:a.data)==null?void 0:r.message)||"Failed to disable 2FA.")}finally{A(!1)}}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold",children:"User Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage your account preferences"})]}),N&&e.jsxs("div",{className:"flex items-start gap-2 p-3 mb-4 rounded-lg bg-destructive/10 text-destructive text-sm",children:[e.jsx(z,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),e.jsx("span",{children:N})]}),y&&e.jsxs("div",{className:"flex items-start gap-2 p-3 mb-4 rounded-lg bg-green-500/10 text-green-600 dark:text-green-400 text-sm",children:[e.jsx(W,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),e.jsx("span",{children:y})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card shadow-soft",children:[e.jsxs("div",{className:"flex items-center gap-2 px-5 py-4 border-b border-border/60",children:[e.jsx($,{}),e.jsx("h2",{className:"text-base font-semibold",children:"Account Settings"})]}),e.jsx("div",{className:"p-5",children:e.jsxs("form",{onSubmit:q,children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"firstName",className:"block text-sm font-medium mb-1.5",children:"First Name"}),e.jsx("input",{type:"text",id:"firstName",value:i.firstName,onChange:m("firstName"),className:"w-full px-3 py-2.5 rounded-lg border border-input bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"lastName",className:"block text-sm font-medium mb-1.5",children:"Last Name"}),e.jsx("input",{type:"text",id:"lastName",value:i.lastName,onChange:m("lastName"),className:"w-full px-3 py-2.5 rounded-lg border border-input bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary"})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium mb-1.5",children:"Email"}),e.jsx("input",{type:"email",id:"email",value:i.email,onChange:m("email"),required:!0,className:"w-full px-3 py-2.5 rounded-lg border border-input bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium mb-1.5",children:"New Password"}),e.jsx("input",{type:"password",id:"password",value:i.password,onChange:m("password"),autoComplete:"new-password",className:"w-full px-3 py-2.5 rounded-lg border border-input bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Leave blank to keep your current password."})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"theme",className:"block text-sm font-medium mb-1.5",children:"Theme Preference"}),e.jsxs("select",{id:"theme",value:H,onChange:s=>T(s.target.value),className:"w-full px-3 py-2.5 rounded-lg border border-input bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary",children:[e.jsx("option",{value:"light",children:"Light"}),e.jsx("option",{value:"dark",children:"Dark"})]})]}),e.jsxs("button",{type:"submit",disabled:w,className:"flex items-center gap-2 px-4 py-2.5 rounded-lg bg-primary text-primary-foreground font-medium text-sm hover:bg-primary/90 disabled:opacity-50 transition-colors",children:[e.jsx(Q,{className:"w-4 h-4"}),w?"Saving...":"Save Changes"]})]})})]})}),e.jsxs("div",{children:[e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card shadow-soft",children:[e.jsxs("div",{className:"flex items-center gap-2 px-5 py-4 border-b border-border/60",children:[e.jsx(g,{className:"w-4 h-4"}),e.jsx("h2",{className:"text-base font-semibold",children:"Two-Factor Authentication"})]}),e.jsx("div",{className:"p-5",children:I?e.jsx("div",{className:"flex justify-center py-6",children:e.jsx(Y,{size:"sm"})}):S==="sso"?e.jsxs("div",{className:"text-center py-4",children:[e.jsx(Z,{className:"w-8 h-8 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Two-factor authentication is managed by your SSO provider (Google/Microsoft)."})]}):S==="enabled"?e.jsxs("div",{className:"text-center py-4",children:[e.jsx(g,{className:"w-8 h-8 text-green-500 mx-auto mb-2"}),e.jsx("p",{className:"text-sm font-medium text-green-600 dark:text-green-400 mb-1",children:"2FA is enabled"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Your account is protected with two-factor authentication."}),e.jsxs("button",{onClick:U,className:"px-4 py-2 rounded-lg border border-destructive/30 text-destructive text-sm font-medium hover:bg-destructive/10 transition-colors",children:[e.jsx(L,{className:"w-4 h-4 inline mr-1"})," Disable 2FA"]})]}):e.jsxs("div",{className:"text-center py-4",children:[e.jsx(_,{className:"w-8 h-8 text-yellow-500 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"2FA is not enabled"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Add an extra layer of security using an authenticator app."}),e.jsxs(u,{to:"/auth/2fa-setup",className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 shadow-soft hover:shadow-glow transition-all",children:[e.jsx(g,{className:"w-4 h-4"})," Enable 2FA"]})]})})]}),e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card shadow-soft mt-6",children:[e.jsxs("div",{className:"flex items-center gap-2 px-5 py-4 border-b border-border/60",children:[e.jsx(J,{className:"w-4 h-4"}),e.jsx("h2",{className:"text-base font-semibold",children:"Personal Integrations"})]}),e.jsxs("div",{className:"p-5",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Connect your own accounts so agents and orchestrations can act on your behalf."}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs(u,{to:"/settings/google",className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors",children:[e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 48 48","aria-hidden":"true",children:[e.jsx("path",{fill:"#FFC107",d:"M43.6 20.5H42V20H24v8h11.3c-1.6 4.6-6 8-11.3 8-6.6 0-12-5.4-12-12s5.4-12 12-12c3 0 5.8 1.2 7.9 3.1l5.7-5.7C34 6.1 29.3 4 24 4 12.9 4 4 12.9 4 24s8.9 20 20 20 20-8.9 20-20c0-1.3-.1-2.7-.4-3.5z"}),e.jsx("path",{fill:"#FF3D00",d:"M6.3 14.7l6.6 4.8C14.7 16 19 13 24 13c3 0 5.8 1.2 7.9 3.1l5.7-5.7C34 6.1 29.3 4 24 4 16.3 4 9.7 8.3 6.3 14.7z"}),e.jsx("path",{fill:"#4CAF50",d:"M24 44c5.2 0 9.9-2 13.4-5.2l-6.2-5.2C29.2 34.8 26.7 36 24 36c-5.3 0-9.7-3.4-11.3-8l-6.5 5C9.5 39.6 16.2 44 24 44z"}),e.jsx("path",{fill:"#1976D2",d:"M43.6 20.5H42V20H24v8h11.3c-.8 2.2-2.2 4.1-4.1 5.5l6.2 5.2c4.3-4 6.6-9.9 6.6-16.2 0-1.3-.1-2.7-.4-3.5z"})]}
6),"Google Workspace"]}),e.jsxs(u,{to:"/settings/microsoft",className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors",children:[e.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 23 23","aria-hidden":"true",children:[e.jsx("path",{fill:"#f25022",d:"M1 1h10v10H1z"}),e.jsx("path",{fill:"#00a4ef",d:"M1 12h10v10H1z"}),e.jsx("path",{fill:"#7fba00",d:"M12 1h10v10H12z"}),e.jsx("path",{fill:"#ffb900",d:"M12 12h10v10H12z"})]}),"Microsoft 365",e.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[9px] font-semibold uppercase tracking-wide bg-amber-500/15 text-amber-700 dark:text-amber-400 border border-amber-500/30",children:"Alpha"})]})]})]})]}),e.jsxs("div",{className:"rounded-xl border border-border/60 bg-card shadow-soft mt-6",children:[e.jsxs("div",{className:"flex items-center gap-2 px-5 py-4 border-b border-border/60",children:[e.jsx(P,{className:"w-4 h-4"}),e.jsx("h2",{className:"text-base font-semibold",children:"My Activity"})]}),e.jsxs("div",{className:"p-5",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Review your recent account and sensitive-access activity."}),e.jsxs(u,{to:"/settings/activity",className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90 shadow-soft hover:shadow-glow transition-all",children:[e.jsx(P,{className:"w-4 h-4"}),"Open My Activity"]})]})]})]})]}),B&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[10vh] bg-black/40 backdrop-blur-sm",onClick:()=>!n&&d(!1),children:e.jsxs("div",{onClick:s=>s.stopPropagation(),className:"bg-card border border-border rounded-xl shadow-xl w-full max-w-md flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border/60",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(L,{className:"w-4 h-4 text-destructive"})," Disable Two-Factor Authentication"]}),e.jsx("button",{onClick:()=>d(!1),disabled:n,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":"Close",children:e.jsx(K,{className:"w-4 h-4"})})]}),e.jsxs("form",{onSubmit:V,className:"p-5",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Disabling two-factor authentication makes your account less secure. Enter your password to confirm."}),F&&e.jsxs("div",{className:"flex items-start gap-2 p-3 mb-4 rounded-lg bg-destructive/10 text-destructive text-sm",children:[e.jsx(z,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),e.jsx("span",{children:F})]}),e.jsxs("div",{className:"mb-5",children:[e.jsx("label",{htmlFor:"disable2faPassword",className:"block text-sm font-medium mb-1.5",children:"Password"}),e.jsx("input",{type:"password",id:"disable2faPassword",value:p,onChange:s=>C(s.target.value),required:!0,autoFocus:!0,autoComplete:"current-password",className:"w-full px-3 py-2.5 rounded-lg border border-input bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary"})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:()=>d(!1),disabled:n,className:"px-4 py-2 rounded-lg border border-border text-sm font-medium hover:bg-accent transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:n||!p,className:"px-4 py-2 rounded-lg bg-destructive text-destructive-foreground text-sm font-medium hover:bg-destructive/90 disabled:opacity-50 transition-colors",children:n?"Disabling...":"Disable 2FA"})]})]})]})})]})}function $(){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M20 7h-9"}),e.jsx("path",{d:"M14 17H5"}),e.jsx("circle",{cx:"17",cy:"17",r:"3"}),e.jsx("circle",{cx:"7",cy:"7",r:"3"})]})}export{ae 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.