PageSourceSearch

https://smritea.ai/assets/UserProfilePage-B4YaS1gA.js

js smritea.ai collected 2026-10-05 15:07:17 UTC 9,957 bytes, 21 lines download raw bytes

1import{c as N,e as W,o as A,r as f,Q as U,j as s,I as d,B as m,a8 as y,H as X,br as Z,bs as H,t as o,bt as ss,bu as es,bv as q,bw as _,bx as F,by as rs,bz as as}from"./index-OkXy-d5Y.js";import{A as M,a as z}from"./alert-0QuNooNy.js";import{A as ts,b as is,c as ns,d as os,e as ds,f as cs,g as ls,h as hs}from"./alert-dialog-Dc3pT7KS.js";import{B as L}from"./badge-D70DEMXH.js";import{C as g,a as v,c as P,b,d as E}from"./card-BOYNs0rn.js";import{L as c}from"./label-B8fcy5Qd.js";import{S as O}from"./skeleton-CTnX7jIE.js";import{u as I}from"./index.esm-B_a780Xx.js";import{U as ms}from"./user-UwyjQNvF.js";import{L as xs}from"./lock-BKSEzYPl.js";/**
2 * @license lucide-react v0.487.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 us=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ws=N("key-round",us);/**
7 * @license lucide-react v0.487.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const ps=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],js=N("link-2",ps);/**
12 * @license lucide-react v0.487.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const fs=[["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"}]],ys=N("shield",fs);/**
17 * @license lucide-react v0.487.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const gs=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],vs=N("unlink",gs),Ps=[{id:"google",label:"Google",color:"bg-info-surface text-info border border-info-border"},{id:"github",label:"GitHub",color:"bg-secondary text-secondary-foreground border border-border"}];function Is(){const l=W(),r=A(X),T=A(Z),x=A(es),[h,u]=f.useState(null),[k,C]=f.useState(!1),w=I(),t=I(),i=I(),V=t.watch("newPassword"),B=i.watch("newPassword");f.useEffect(()=>{l(U())},[l]),f.useEffect(()=>{r&&w.reset({name:(r==null?void 0:r.name)||""})},[r,w]);const R=async e=>{const a=await l(H({name:e.name}));H.fulfilled.match(a)&&o({title:"Profile updated"})},$=async e=>{const a=y(e.newPassword);if(!a.valid){o({title:"Error",description:a.error||"Invalid password",variant:"destructive"});return}const p=(r==null?void 0:r.email)||"",S=await q(e.oldPassword,p),j=await q(e.newPassword,p),D=await l(_({oldPassword:S,newPassword:j}));_.fulfilled.match(D)?(t.reset(),o({title:"Password changed"})):o({title:"Error",description:D.payload??"Failed to change password",variant:"destructive"})},n=r,G=(n==null?void 0:n.hasPassword)!==!1,K=(n==null?void 0:n.oauthProviders)||[],Q=async e=>{const a=y(e.newPassword);if(!a.valid){o({title:"Error",description:a.error||"Invalid password",variant:"destructive"});return}const p=(n==null?void 0:n.email)||"",S=await q(e.newPassword,p),j=await l(F({newPassword:S}));F.fulfilled.match(j)?(i.reset(),o({title:"Password set successfully"}),l(U())):o({title:"Error",description:j.payload??"Failed to set password",variant:"destructive"})},Y=e=>{ss(e)},J=async()=>{if(h){C(!0);try{const e=await rs(h);if(!e.canUnlink){o({title:"Error",description:e.reason||"Cannot unlink this provider",variant:"destructive"}),u(null),C(!1);return}await as(h),o({title:`${h} account unlinked`}),l(U())}catch{}finally{C(!1),u(null)}}};return T&&!r?s.jsxs("div",{className:"space-y-4",children:[s.jsx(O,{className:"h-8 w-48"}),s.jsx(O,{className:"h-48 rounded-lg"})]}):s.jsxs("div",{className:"space-y-6 max-w-2xl",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl",children:"User Profile"}),s.jsx("p",{className:"text-muted-foreground",children:"Manage your account settings"})]}),s.jsxs(g,{children:[s.jsx(v,{children:s.jsxs(P,{className:"text-base flex items-center gap-2",children:[s.jsx(ms,{className:"h-4 w-4"})," Profile Information"]})}),s.jsx(b,{children:s.jsxs("form",{onSubmit:w.handleSubmit(R),className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(c,{children:"Full Name"}),s.jsx(d,{...w.register("name",{required:"Name is required"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(c,{children:"Email"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(d,{value:(r==null?void 0:r.email)||"",disabled:!0,className:"flex-1"}),r!=null&&r.verified?s.jsx(L,{className:"bg-success-surface text-success border border-success-border",children:"Verified"}):s.jsx(L,{variant:"destructive",children:"Unverified"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(c,{children:"User ID"}),s.jsx(d,{value:(r==null?void 0:r.id)||"",disabled:!0})]}),s.jsx(m,{type:"submit",children:"Save Changes"})]})})]}),s.jsxs(g,{children:[s.jsxs(v,{children:[s.jsxs(P,{className:"text-base flex items-center gap-2",children:[s.jsx(ys,{className:"h-4 w-4"})," Connected Accounts"]}),s.jsx(E,{children:"Link or unlink third-party authentication providers."})]}),s.jsx(b,{className:"space-y-3",children:Ps.map(e=>{const a=K.includes(e.id);return s.jsxs("div",{className:"flex flex-col gap-2 border-b py-3 last:border-b-0 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(L,{className:e.color,children:e.label}),s.jsx("span",{className:"text-sm text-muted-foreground",children:a?"Connected":"Not connected"})]}),a?s.jsxs(m,{variant:"outline",size:"sm",onClick:()=>u(e.id),className:"text-destructive hover:text-destructive",children:[s.jsx(vs,{className:"mr-2 h-3 w-3"})," Unlink"]}):s.jsxs(m,{variant:"outline",size:"sm",onClick:()=>Y(e.id),children:[s.jsx(js,{className:"mr-2 h-3 w-3"})," Link"]})]},e.id)})})]}),s.jsxs(g,{children:[s.jsxs(v,{children:[s.jsxs(P,{className:"text-base flex items-center gap-2",children:[s.jsx(xs,{className:"h-4 w-4"})," Change Password"]}),s.jsx(E,{children:"Update your password. Must meet all security requirements."})]}),s.jsx(b,{children:s.jsxs("form",{onSubmit:t.handleSubmit($),className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(c,{children:"Current Password"}),s.jsx(d,{type:"password",...t.register("oldPassword",{required:"Current password is required"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(c,{children:"New Password"}),s.jsx(d,{type:"password",...t.register("newPassword",{required:"New password is required",validate:e=>{const a=y(e);return a.valid||a.error||"Invalid password"}})}),t.formState.errors.newPassword&&s.jsx("p",{className:"text-xs text-destructive",children:t.formState.errors.newPassword.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(c,{children:"Confirm New Password"}),s.jsx(d,{type:"password",...t.register("confirmPassword",{required:"Please confirm your password",validate:e=>e===V||"Passwords do not match"})}),t.formState.errors.confirmPassword&&s.jsx("p",{className:"text-xs text-destructive",children:t.formState.errors.confirmPassword.message})]}),s.jsx(M,{children:s.jsx(z,{className:"text-xs",children:"Password must be 8-128 chars with uppercase, lowercase, digit, and special character."})}),s.jsx(m,{type:"submit",disabled:x,children:x?"Changing...":"Change Password"})]})})]}),!G&&s.jsxs(g,{children:[s.jsxs(v,{children:[s.jsxs(P,{className:"text-base flex items-center gap-2",children:[s.jsx(ws,{className:"h-4 w-4"})," Set Password"]}
21),s.jsx(E,{children:"Set a password for your account. Must meet all security requirements."})]}),s.jsx(b,{children:s.jsxs("form",{onSubmit:i.handleSubmit(Q),className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(c,{children:"New Password"}),s.jsx(d,{type:"password",...i.register("newPassword",{required:"New password is required",validate:e=>{const a=y(e);return a.valid||a.error||"Invalid password"}})}),i.formState.errors.newPassword&&s.jsx("p",{className:"text-xs text-destructive",children:i.formState.errors.newPassword.message})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(c,{children:"Confirm New Password"}),s.jsx(d,{type:"password",...i.register("confirmPassword",{required:"Please confirm your password",validate:e=>e===B||"Passwords do not match"})}),i.formState.errors.confirmPassword&&s.jsx("p",{className:"text-xs text-destructive",children:i.formState.errors.confirmPassword.message})]}),s.jsx(M,{children:s.jsx(z,{className:"text-xs",children:"Password must be 8-128 chars with uppercase, lowercase, digit, and special character."})}),s.jsx(m,{type:"submit",disabled:x,children:x?"Setting...":"Set Password"})]})})]}),s.jsx(ts,{open:h!==null,onOpenChange:e=>{e||u(null)},children:s.jsxs(is,{children:[s.jsxs(ns,{children:[s.jsxs(os,{children:["Unlink ",h,"?"]}),s.jsxs(ds,{children:["You will no longer be able to sign in with your ",h," account. Make sure you have a password set or another provider linked."]})]}),s.jsxs(cs,{children:[s.jsx(ls,{disabled:k,children:"Cancel"}),s.jsx(hs,{onClick:J,disabled:k,className:"bg-destructive text-destructive-foreground",children:k?"Unlinking...":"Unlink"})]})]})})]})}export{Is as UserProfilePage};

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.