MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / buildDeviceLabel

Function buildDeviceLabel

server-source-code/internal/handler/auth.go:551–562  ·  view source on GitHub ↗

buildDeviceLabel produces a short "Browser on OS" string from a User-Agent. Used for display in the Trusted Devices list; never used for trust decisions.

(ua string)

Source from the content-addressed store, hash-verified

549// buildDeviceLabel produces a short "Browser on OS" string from a User-Agent.
550// Used for display in the Trusted Devices list; never used for trust decisions.
551func buildDeviceLabel(ua string) string {
552 p := parseUserAgent(ua)
553 browser := p["browser"]
554 os := p["os"]
555 if browser == "" {
556 browser = "Unknown browser"
557 }
558 if os == "" {
559 os = "Unknown OS"
560 }
561 return browser + " on " + os
562}
563
564func (h *AuthHandler) clientIP(r *http.Request) string {
565 if h.resolved != nil && !h.resolved.TrustProxy {

Callers 1

completeLoginMethod · 0.85

Calls 1

parseUserAgentFunction · 0.85

Tested by

no test coverage detected