feat: Add Bulk Registration, Change Password, and update Auth UI

This commit is contained in:
2026-09-24 20:53:21 +05:30
parent 3ed7028bda
commit 85974b97f5
7 changed files with 204 additions and 14 deletions

View File

@@ -69,6 +69,44 @@ export default function SettingsPage() {
}
};
const [currentPassword, setCurrentPassword] = useState("");
const [newPassword, setNewPassword] = useState("");
const [confirmPassword, setConfirmPassword] = useState("");
const [passwordSaving, setPasswordSaving] = useState(false);
const handleChangePassword = async () => {
if (newPassword !== confirmPassword) {
alert("New passwords do not match.");
return;
}
setPasswordSaving(true);
try {
const res = await fetchWithAuth("/api/auth/change-password", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
current_password: currentPassword,
new_password: newPassword,
}),
});
const data = await res.json();
if (res.ok) {
alert(data.message || "Password updated successfully!");
setCurrentPassword("");
setNewPassword("");
setConfirmPassword("");
} else {
alert("Failed to change password: " + (data.detail || "Unknown error"));
}
} catch (err) {
console.error(err);
alert("Network error. Could not change password.");
} finally {
setPasswordSaving(false);
}
};
const handleSave = async () => {
if (!userId) return;
setSaving(true);