From c3c7a34d6762031dfa79fc7a98ff37c84c6423d7 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 16:01:17 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/admin.users.tsx | 65 +++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/src/routes/admin.users.tsx b/src/routes/admin.users.tsx index af07c44..68fb4ef 100644 --- a/src/routes/admin.users.tsx +++ b/src/routes/admin.users.tsx @@ -189,7 +189,7 @@ function UsersPage() { Email Role Hourly rate - + Actions @@ -315,6 +315,69 @@ function RateInput({ } +function SetPasswordDialog({ userId, email }: { userId: string; email: string }) { + const [open, setOpen] = useState(false); + const [password, setPassword] = useState(""); + const [submitting, setSubmitting] = useState(false); + + const onSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + setSubmitting(true); + const { error } = await supabase.functions.invoke("admin-set-password", { + body: { user_id: userId, password }, + }); + setSubmitting(false); + if (error) { + toast.error("Could not change password", { description: error.message }); + return; + } + toast.success("Password updated", { + description: "Share the new password securely with the user.", + }); + setPassword(""); + setOpen(false); + }; + + return ( + + + + + + + Change password + + Set a new password for {email}. Share it with them through a secure channel. + + +
+
+ + setPassword(e.target.value)} + minLength={10} + required + autoFocus + /> +

Min 10 characters.

+
+ + + +
+
+
+ ); +} + function InviteDialog({ onCreated }: { onCreated: () => void }) { const [email, setEmail] = useState(""); const [fullName, setFullName] = useState("");