prod
This commit is contained in:
+5
-1
@@ -9,7 +9,7 @@ import { deleteUser, updateUser } from "./repository";
|
||||
import { getAccessToken } from "@/lib/auth/tokens";
|
||||
import { fetchKotosoftUser } from "@/lib/kotosoft/client";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { getCurrentUser } from "../user";
|
||||
import { getCurrentUser, getUser } from "../user";
|
||||
import { runAction } from "@/lib/run-action";
|
||||
import { AppError, type ActionResult } from "@/lib/action-result";
|
||||
|
||||
@@ -61,6 +61,10 @@ export async function updateUserAction(): Promise<ActionResult> {
|
||||
const userId = await getSessionUserId();
|
||||
if (!userId) throw new AppError("Not authenticated");
|
||||
|
||||
const user = await getUser(userId);
|
||||
|
||||
if (user?.kotosoftId !== kotosoftUser.id) throw new AppError("Your session does not match your Kotosoft ID account");
|
||||
|
||||
await updateUser(userId, {
|
||||
email: kotosoftUser.email,
|
||||
firstName: kotosoftUser.first_name,
|
||||
|
||||
Reference in New Issue
Block a user