mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-02 02:57:15 +08:00
PR comments
This commit is contained in:
parent
ffefd56192
commit
2e7c596f7f
@ -740,15 +740,11 @@ func handleAdminDiscordUnlink(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
httpError(w, r, err, http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
username := r.Form.Get("username")
|
||||
discordId := r.Form.Get("discordId")
|
||||
|
||||
if username != "" {
|
||||
switch {
|
||||
case username != "":
|
||||
log.Printf("Username given, removing discordId")
|
||||
// this does a quick call to make sure the username exists on the server before allowing the rest of the code to run
|
||||
// this calls error value 404 (StatusNotFound) if there's no data; this means the username does not exist in the server
|
||||
@ -757,19 +753,21 @@ func handleAdminDiscordUnlink(w http.ResponseWriter, r *http.Request) {
|
||||
httpError(w, r, fmt.Errorf("username does not exist on the server"), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
err = db.RemoveDiscordIdByUsername(username)
|
||||
if err != nil {
|
||||
httpError(w, r, err, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
if discordId != "" {
|
||||
|
||||
case discordId != "":
|
||||
log.Printf("DiscordID given, removing discordId")
|
||||
err = db.RemoveDiscordIdByDiscordId(discordId)
|
||||
if err != nil {
|
||||
httpError(w, r, err, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
log.Printf("%s: %s removed discord id %s from username %s", userDiscordId, r.URL.Path, r.Form.Get("discordId"), r.Form.Get("username"))
|
||||
@ -849,15 +847,11 @@ func handleAdminGoogleUnlink(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
httpError(w, r, err, http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
username := r.Form.Get("username")
|
||||
googleId := r.Form.Get("googleId")
|
||||
|
||||
if username != "" {
|
||||
switch {
|
||||
case username != "":
|
||||
log.Printf("Username given, removing googleId")
|
||||
// this does a quick call to make sure the username exists on the server before allowing the rest of the code to run
|
||||
// this calls error value 404 (StatusNotFound) if there's no data; this means the username does not exist in the server
|
||||
@ -866,19 +860,21 @@ func handleAdminGoogleUnlink(w http.ResponseWriter, r *http.Request) {
|
||||
httpError(w, r, fmt.Errorf("username does not exist on the server"), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
err = db.RemoveGoogleIdByUsername(username)
|
||||
if err != nil {
|
||||
httpError(w, r, err, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
if googleId != "" {
|
||||
|
||||
case googleId != "":
|
||||
log.Printf("DiscordID given, removing googleId")
|
||||
err = db.RemoveGoogleIdByDiscordId(googleId)
|
||||
if err != nil {
|
||||
httpError(w, r, err, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
log.Printf("%s: %s removed google id %s from username %s", userDiscordId, r.URL.Path, r.Form.Get("googleId"), r.Form.Get("username"))
|
||||
@ -911,11 +907,6 @@ func handleAdminSearch(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
httpError(w, r, err, http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
username := r.Form.Get("username")
|
||||
|
||||
// this does a quick call to make sure the username exists on the server before allowing the rest of the code to run
|
||||
|
Loading…
x
Reference in New Issue
Block a user