Add token length check to account info handler
parent
b1e67634df
commit
be62fc939a
|
@ -41,6 +41,11 @@ func (s *Server) HandleAccountInfo(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(token) != 32 {
|
||||||
|
http.Error(w, "invalid token", http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
username, err := db.GetUsernameFromToken(token)
|
username, err := db.GetUsernameFromToken(token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
|
|
Loading…
Reference in New Issue