MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / handleRejectMagicLinkPost

Method handleRejectMagicLinkPost

internal/agent/hitl_magic_api.go:100–122  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

98}
99
100func (a *API) handleRejectMagicLinkPost(w http.ResponseWriter, r *http.Request) {
101 if a.approvalSigner == nil {
102 http.NotFound(w, r)
103 return
104 }
105 token := extractFormToken(r)
106 claims, status, errMsg := a.verifyMagicToken(token, approvaltoken.ActionReject)
107 if errMsg != "" {
108 writeMagicMessage(w, status, "Invalid confirmation", errMsg)
109 return
110 }
111 userID, _, err := a.store.ResolveOutboundOwner(r.Context(), claims.MessageID)
112 if err != nil {
113 writeMagicMessage(w, http.StatusNotFound, "Message not found",
114 "This message no longer exists.")
115 return
116 }
117 reason := strings.TrimSpace(r.FormValue("reason"))
118 if reason == "" {
119 reason = "magic-link rejection"
120 }
121 a.magicReject(w, r, claims.MessageID, userID, reason)
122}
123
124// extractFormToken pulls the token from standard form encoding. Request
125// body is expected to be application/x-www-form-urlencoded since the

Callers

nothing calls this directly

Calls 5

verifyMagicTokenMethod · 0.95
magicRejectMethod · 0.95
extractFormTokenFunction · 0.85
writeMagicMessageFunction · 0.85
ResolveOutboundOwnerMethod · 0.80

Tested by

no test coverage detected