mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 15:26:40 +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 == "" {
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
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 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(() => {
|
||||
document.title = `${title} - NetBird Service`;
|
||||
}, [title]);
|
||||
@@ -27,12 +27,14 @@ export function ErrorPage({ code, title, message, proxy = true, destination = tr
|
||||
{/* Description */}
|
||||
<Description className="mt-2 mb-8 max-w-md">{message}</Description>
|
||||
|
||||
{/* Status Cards */}
|
||||
<div className="hidden sm:flex items-start justify-center w-full mt-6 mb-16 z-10 relative">
|
||||
<StatusCard icon={UserIcon} label="You" line={false} />
|
||||
<StatusCard icon={WaypointsIcon} label="Proxy" success={proxy} />
|
||||
<StatusCard icon={Globe} label="Destination" success={destination} />
|
||||
</div>
|
||||
{/* Status Cards - hidden in simple mode */}
|
||||
{!simple && (
|
||||
<div className="hidden sm:flex items-start justify-center w-full mt-6 mb-16 z-10 relative">
|
||||
<StatusCard icon={UserIcon} label="You" line={false} />
|
||||
<StatusCard icon={WaypointsIcon} label="Proxy" success={proxy} />
|
||||
<StatusCard icon={Globe} label="Destination" success={destination} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Buttons */}
|
||||
<div className="flex gap-3 justify-center items-center mb-6 z-10 relative">
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface ErrorData {
|
||||
proxy?: boolean
|
||||
destination?: boolean
|
||||
requestId?: string
|
||||
simple?: boolean
|
||||
}
|
||||
|
||||
// Data injected by Go templates
|
||||
|
||||
@@ -160,3 +160,17 @@ func ServeErrorPage(w http.ResponseWriter, r *http.Request, code int, title, mes
|
||||
},
|
||||
}, 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