remove broken auth UI from header; PR firms now authenticate at distribute platform
- Header.tsx: remove "SIGN IN" and "REGISTER" buttons from the top utility bar and the mobile drawer. Auth for PR firms / writers lives at distribution.relevantmediaproperties.com now; the local /client-login and /register routes are no longer the right entry point. - src/middleware.ts (new): 301-redirect /wp-login, /wp-login.php, /wp-admin, /wp-admin/*, /login, /client-login, and /register to https://distribution.relevantmediaproperties.com/login so existing bookmarks and old WP-era links land somewhere useful instead of 404. - Newsletter signup form, social icons, country selector all retained. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -274,16 +274,9 @@ export default function Header() {
|
||||
{/* Language Switcher — Section 18B */}
|
||||
<LanguageSwitcher compact />
|
||||
<div className="w-px h-3.5 bg-[#333] mx-1" />
|
||||
{!currentUserId && (
|
||||
<>
|
||||
<Link href="/client-login" className="text-[#999] hover:text-[#3b82f6] focus:text-[#3b82f6] focus:outline-none focus-visible:ring-1 focus-visible:ring-[#3b82f6] transition-colors text-xs font-body font-bold uppercase tracking-wider">
|
||||
Sign In
|
||||
</Link>
|
||||
<Link href="/register" className="text-[#999] hover:text-[#3b82f6] focus:text-[#3b82f6] focus:outline-none focus-visible:ring-1 focus-visible:ring-[#3b82f6] transition-colors text-xs font-body font-bold uppercase tracking-wider">
|
||||
Register
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
{/* Sign In / Register removed — PR firms now authenticate at
|
||||
distribution.relevantmediaproperties.com; /wp-login,
|
||||
/wp-admin, /login redirect there from middleware. */}
|
||||
{currentUserId && (
|
||||
<Link href="/account" className="text-[#999] hover:text-[#3b82f6] focus:text-[#3b82f6] focus:outline-none focus-visible:ring-1 focus-visible:ring-[#3b82f6] transition-colors text-xs font-body font-bold uppercase tracking-wider">
|
||||
My Profile
|
||||
@@ -525,29 +518,7 @@ export default function Header() {
|
||||
</svg>
|
||||
Reading List
|
||||
</Link>
|
||||
{/* Account / Sign In / Register — anonymous vs authenticated */}
|
||||
{!currentUserId && (
|
||||
<>
|
||||
<Link
|
||||
href="/client-login"
|
||||
className="px-2 py-2.5 text-sm font-body font-bold uppercase tracking-wide text-[#cccccc] hover:text-[#3b82f6] hover:bg-[#1a1a1a] border-b border-[#222] transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[#3b82f6] flex items-center gap-2"
|
||||
onClick={() => setMobileOpen(false)}>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
|
||||
<path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4" /><polyline points="10 17 15 12 10 7" /><line x1="15" y1="12" x2="3" y2="12" />
|
||||
</svg>
|
||||
Sign In
|
||||
</Link>
|
||||
<Link
|
||||
href="/register"
|
||||
className="px-2 py-2.5 text-sm font-body font-bold uppercase tracking-wide text-[#cccccc] hover:text-[#3b82f6] hover:bg-[#1a1a1a] border-b border-[#222] transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-[#3b82f6] flex items-center gap-2"
|
||||
onClick={() => setMobileOpen(false)}>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
|
||||
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" /><circle cx="8.5" cy="7" r="4" /><line x1="20" y1="8" x2="20" y2="14" /><line x1="23" y1="11" x2="17" y2="11" />
|
||||
</svg>
|
||||
Register
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
{/* Sign In / Register removed — see desktop bar comment. */}
|
||||
{currentUserId && (
|
||||
<Link
|
||||
href="/account"
|
||||
|
||||
39
src/middleware.ts
Normal file
39
src/middleware.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { NextResponse, type NextRequest } from "next/server";
|
||||
|
||||
// PR firms / writers authenticate at the distribute platform, not here.
|
||||
// Anything that looks like a WordPress login or the bare /login path
|
||||
// redirects there so old bookmarks don't dead-end.
|
||||
const AUTH_TARGET = "https://distribution.relevantmediaproperties.com/login";
|
||||
|
||||
const REDIRECT_PATHS = new Set<string>([
|
||||
"/login",
|
||||
"/wp-login",
|
||||
"/wp-login.php",
|
||||
"/wp-admin",
|
||||
"/client-login",
|
||||
"/register",
|
||||
]);
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
const path = req.nextUrl.pathname;
|
||||
if (
|
||||
REDIRECT_PATHS.has(path) ||
|
||||
path.startsWith("/wp-admin/") ||
|
||||
path.startsWith("/wp-login/")
|
||||
) {
|
||||
return NextResponse.redirect(AUTH_TARGET, 301);
|
||||
}
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/login",
|
||||
"/wp-login",
|
||||
"/wp-login.php",
|
||||
"/wp-admin/:path*",
|
||||
"/wp-login/:path*",
|
||||
"/client-login",
|
||||
"/register",
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user