test the login yourself4
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
|
||||
'use server';
|
||||
|
||||
import { z } from 'zod';
|
||||
import db from '@/lib/db';
|
||||
import getDb from '@/lib/db';
|
||||
import { revalidatePath } from 'next/cache';
|
||||
import { auth } from '@/auth';
|
||||
|
||||
@@ -21,6 +22,7 @@ type User = {
|
||||
};
|
||||
|
||||
export async function getUserByEmail(email: string): Promise<User | null> {
|
||||
const db = getDb();
|
||||
try {
|
||||
const stmt = db.prepare('SELECT id, name, email, password FROM users WHERE email = ?');
|
||||
const user = stmt.get(email) as User | undefined;
|
||||
@@ -64,6 +66,7 @@ export async function updateUser(data: UserFormValues): Promise<{ success: boole
|
||||
const { name, email, password } = validation.data;
|
||||
|
||||
try {
|
||||
const db = getDb();
|
||||
const userId = session.user.id;
|
||||
|
||||
// Check if the new email is already taken by another user
|
||||
|
||||
Reference in New Issue
Block a user