From 36159df66d44e6304795b8550a5adadcace49423 Mon Sep 17 00:00:00 2001 From: Leon Serfaty G Date: Thu, 17 Jul 2025 11:36:27 +0000 Subject: [PATCH] same thing continues to happen. I cant change credentials... please debo --- src/lib/actions/user.ts | 4 ++-- src/lib/auth.ts | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/actions/user.ts b/src/lib/actions/user.ts index c93808d..34de759 100644 --- a/src/lib/actions/user.ts +++ b/src/lib/actions/user.ts @@ -4,7 +4,7 @@ import db from '@/lib/db'; import type { User } from '@/lib/types'; import { z } from 'zod'; -import { auth } from '@/app/api/auth/[...nextauth]/route'; +import { auth } from '@/lib/auth'; const UserUpdateSchema = z.object({ name: z.string().min(1, 'Name is required'), @@ -46,8 +46,8 @@ export async function updateUser( const { name, email, password } = validated.data; try { + // In a real application, you should hash the password! if (password && password.trim().length > 0) { - // In a real application, hash the password const stmt = db.prepare( 'UPDATE users SET name = ?, email = ?, password = ? WHERE id = ?' ); diff --git a/src/lib/auth.ts b/src/lib/auth.ts index 9adcf69..c6ad43d 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -1,7 +1,11 @@ 'use server'; -import { signOut as nextAuthSignOut } from '@/app/api/auth/[...nextauth]/route'; +import { signOut as nextAuthSignOut, auth as nextAuth } from '@/app/api/auth/[...nextauth]/route'; export async function signOut() { await nextAuthSignOut({ redirectTo: '/login' }); } + +export async function auth() { + return nextAuth(); +}