@@ -2,7 +2,7 @@
|
||||
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { redirect } from "next/navigation";
|
||||
import { isRedirectError } from "next/dist/client/components/redirect";
|
||||
import { isRedirectError } from "next/dist/client/components/redirect-error";
|
||||
|
||||
import { toInternalAdminPath } from "@/lib/admin-routing";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
@@ -13,9 +13,9 @@ import {
|
||||
} from "@/lib/app-config";
|
||||
import type { ContactProtectionSettings } from "@/lib/contact-protection";
|
||||
|
||||
function ensureAdmin() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
clearAdminSessionCookie();
|
||||
async function ensureAdmin() {
|
||||
if (!(await isAdminAuthenticated())) {
|
||||
await clearAdminSessionCookie();
|
||||
redirect("/");
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ function parseContactProtectionFormData(
|
||||
}
|
||||
|
||||
export async function saveContactProtectionSettingsAction(formData: FormData) {
|
||||
ensureAdmin();
|
||||
await ensureAdmin();
|
||||
|
||||
try {
|
||||
const existingSettings = await getContactProtectionSettings();
|
||||
|
||||
@@ -26,14 +26,14 @@ const copy = {
|
||||
};
|
||||
|
||||
export default async function RootSMTPProtectionPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
if (!(await isAdminAuthenticated())) {
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
await clearAdminSessionCookie();
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user