Include user id in authentication response
This commit is contained in:
parent
b83b816ce8
commit
68e3aa6d10
1 changed files with 6 additions and 3 deletions
7
users.go
7
users.go
|
@ -118,10 +118,13 @@ func serveAuthenticateUser(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var token struct {
|
token := struct {
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
|
UserID int64 `json:"user_id"`
|
||||||
|
}{
|
||||||
|
Token: tokenString,
|
||||||
|
UserID: user_session.Id,
|
||||||
}
|
}
|
||||||
token.Token = tokenString
|
|
||||||
data, err := json.Marshal(token)
|
data, err := json.Marshal(token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
|
Reference in a new issue