feat: admin interface: cannot delete self
This commit is contained in:
parent
a89f197fdd
commit
b477730140
@ -29,6 +29,13 @@ func (app *Application) DeletePlayer(usr *user.User, w http.ResponseWriter, r *h
|
|||||||
fmt.Fprintf(w, "forbidden")
|
fmt.Fprintf(w, "forbidden")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if deleteUser.GetId() == usr.GetId() {
|
||||||
|
w.WriteHeader(http.StatusForbidden)
|
||||||
|
fmt.Printf("can't delete yourself\n")
|
||||||
|
fmt.Fprintf(w, "forbidden")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := deleteUser.DeleteUser(); err != nil {
|
if err := deleteUser.DeleteUser(); err != nil {
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
fmt.Printf("%v\n", err)
|
fmt.Printf("%v\n", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user