Include user id in authentication response

This commit is contained in:
Matthew Dillon 2015-04-10 13:41:00 -08:00
parent b83b816ce8
commit 68e3aa6d10

View file

@ -118,10 +118,13 @@ func serveAuthenticateUser(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
return
}
var token struct {
Token string `json:"token"`
token := struct {
Token string `json:"token"`
UserID int64 `json:"user_id"`
}{
Token: tokenString,
UserID: user_session.Id,
}
token.Token = tokenString
data, err := json.Marshal(token)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)