same thing continues to happen. I cant change credentials... please debo
This commit is contained in:
@@ -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 = ?'
|
||||
);
|
||||
|
||||
+5
-1
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user