mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 16:26:38 +00:00
update error page
This commit is contained in:
@@ -95,7 +95,7 @@ func (mw *Middleware) Protect(next http.Handler) http.Handler {
|
|||||||
if errDesc == "" {
|
if errDesc == "" {
|
||||||
errDesc = "An error occurred during authentication"
|
errDesc = "An error occurred during authentication"
|
||||||
}
|
}
|
||||||
web.ServeErrorPage(w, r, http.StatusForbidden, "Access Denied", errDesc, requestID, web.ErrorStatus{Proxy: true, Destination: true})
|
web.ServeAccessDeniedPage(w, r, http.StatusForbidden, "Access Denied", errDesc, requestID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
proxy/web/dist/assets/index.js
vendored
10
proxy/web/dist/assets/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -7,7 +7,7 @@ import { PoweredByNetBird } from "@/components/PoweredByNetBird";
|
|||||||
import { StatusCard } from "@/components/StatusCard";
|
import { StatusCard } from "@/components/StatusCard";
|
||||||
import type { ErrorData } from "@/data";
|
import type { ErrorData } from "@/data";
|
||||||
|
|
||||||
export function ErrorPage({ code, title, message, proxy = true, destination = true, requestId }: ErrorData) {
|
export function ErrorPage({ code, title, message, proxy = true, destination = true, requestId, simple = false }: ErrorData) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.title = `${title} - NetBird Service`;
|
document.title = `${title} - NetBird Service`;
|
||||||
}, [title]);
|
}, [title]);
|
||||||
@@ -27,12 +27,14 @@ export function ErrorPage({ code, title, message, proxy = true, destination = tr
|
|||||||
{/* Description */}
|
{/* Description */}
|
||||||
<Description className="mt-2 mb-8 max-w-md">{message}</Description>
|
<Description className="mt-2 mb-8 max-w-md">{message}</Description>
|
||||||
|
|
||||||
{/* Status Cards */}
|
{/* Status Cards - hidden in simple mode */}
|
||||||
<div className="hidden sm:flex items-start justify-center w-full mt-6 mb-16 z-10 relative">
|
{!simple && (
|
||||||
<StatusCard icon={UserIcon} label="You" line={false} />
|
<div className="hidden sm:flex items-start justify-center w-full mt-6 mb-16 z-10 relative">
|
||||||
<StatusCard icon={WaypointsIcon} label="Proxy" success={proxy} />
|
<StatusCard icon={UserIcon} label="You" line={false} />
|
||||||
<StatusCard icon={Globe} label="Destination" success={destination} />
|
<StatusCard icon={WaypointsIcon} label="Proxy" success={proxy} />
|
||||||
</div>
|
<StatusCard icon={Globe} label="Destination" success={destination} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Buttons */}
|
{/* Buttons */}
|
||||||
<div className="flex gap-3 justify-center items-center mb-6 z-10 relative">
|
<div className="flex gap-3 justify-center items-center mb-6 z-10 relative">
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export interface ErrorData {
|
|||||||
proxy?: boolean
|
proxy?: boolean
|
||||||
destination?: boolean
|
destination?: boolean
|
||||||
requestId?: string
|
requestId?: string
|
||||||
|
simple?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data injected by Go templates
|
// Data injected by Go templates
|
||||||
|
|||||||
@@ -160,3 +160,17 @@ func ServeErrorPage(w http.ResponseWriter, r *http.Request, code int, title, mes
|
|||||||
},
|
},
|
||||||
}, code)
|
}, code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ServeAccessDeniedPage renders a simple access denied page without the connection status graph.
|
||||||
|
func ServeAccessDeniedPage(w http.ResponseWriter, r *http.Request, code int, title, message, requestID string) {
|
||||||
|
ServeHTTP(w, r, map[string]any{
|
||||||
|
"page": "error",
|
||||||
|
"error": map[string]any{
|
||||||
|
"code": code,
|
||||||
|
"title": title,
|
||||||
|
"message": message,
|
||||||
|
"requestId": requestID,
|
||||||
|
"simple": true,
|
||||||
|
},
|
||||||
|
}, code)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user