--- POST executors ---
(w http.ResponseWriter, r *http.Request)
| 78 | // --- POST executors --- |
| 79 | |
| 80 | func (a *API) handleApproveMagicLinkPost(w http.ResponseWriter, r *http.Request) { |
| 81 | if a.approvalSigner == nil { |
| 82 | http.NotFound(w, r) |
| 83 | return |
| 84 | } |
| 85 | token := extractFormToken(r) |
| 86 | claims, status, errMsg := a.verifyMagicToken(token, approvaltoken.ActionApprove) |
| 87 | if errMsg != "" { |
| 88 | writeMagicMessage(w, status, "Invalid confirmation", errMsg) |
| 89 | return |
| 90 | } |
| 91 | userID, agentID, err := a.store.ResolveOutboundOwner(r.Context(), claims.MessageID) |
| 92 | if err != nil { |
| 93 | writeMagicMessage(w, http.StatusNotFound, "Message not found", |
| 94 | "This message no longer exists.") |
| 95 | return |
| 96 | } |
| 97 | a.magicApprove(w, r, claims.MessageID, userID, agentID) |
| 98 | } |
| 99 | |
| 100 | func (a *API) handleRejectMagicLinkPost(w http.ResponseWriter, r *http.Request) { |
| 101 | if a.approvalSigner == nil { |
nothing calls this directly
no test coverage detected