From 799117d287e05467845974739ba0046f5b0f7234 Mon Sep 17 00:00:00 2001 From: dmitriylaukhin Date: Mon, 11 May 2026 17:10:18 +0500 Subject: [PATCH] Fix change-password form to use direct fetch instead of authClient authClient.changePassword does not exist in better-auth v1.6 client bundle. Use direct POST to /api/auth/change-password endpoint instead. Co-Authored-By: Claude Sonnet 4.6 --- src/app/(student)/profile/change-password-form.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app/(student)/profile/change-password-form.tsx b/src/app/(student)/profile/change-password-form.tsx index 9aa6e49..21d1af9 100644 --- a/src/app/(student)/profile/change-password-form.tsx +++ b/src/app/(student)/profile/change-password-form.tsx @@ -1,7 +1,6 @@ "use client"; import { useState } from "react"; -import { authClient } from "@/lib/auth-client"; const inputStyle: React.CSSProperties = { border: "2px solid var(--border)", @@ -33,14 +32,14 @@ export function ChangePasswordForm() { } setLoading(true); - const result = await authClient.changePassword({ - currentPassword: current, - newPassword: next, - revokeOtherSessions: false, + const res = await fetch("/api/auth/change-password", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ currentPassword: current, newPassword: next, revokeOtherSessions: false }), }); setLoading(false); - if (result.error) { + if (!res.ok) { setError("Неверный текущий пароль"); return; }