mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-02 19:17:14 +08:00
chore: Add logging for Discord ID addition in admin Discord link endpoint
This commit is contained in:
parent
715fe93440
commit
fd57ad36fb
@ -23,6 +23,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -684,7 +685,6 @@ func handleAdminDiscordLink(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hasRole, err := account.IsUserDiscordAdmin(userDiscordId, account.DiscordGuildID)
|
hasRole, err := account.IsUserDiscordAdmin(userDiscordId, account.DiscordGuildID)
|
||||||
|
|
||||||
if !hasRole || err != nil {
|
if !hasRole || err != nil {
|
||||||
httpError(w, r, fmt.Errorf("user does not have the required role"), http.StatusForbidden)
|
httpError(w, r, fmt.Errorf("user does not have the required role"), http.StatusForbidden)
|
||||||
return
|
return
|
||||||
@ -695,6 +695,6 @@ func handleAdminDiscordLink(w http.ResponseWriter, r *http.Request) {
|
|||||||
httpError(w, r, err, http.StatusInternalServerError)
|
httpError(w, r, err, http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Printf("%s added discord id %s to username %s", userDiscordId, r.Form.Get("discordId"), r.Form.Get("username"))
|
log.Printf("%s added discord id %s to username %s", userDiscordId, r.Form.Get("discordId"), r.Form.Get("username"))
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user