feat: output game id with log messages
This commit is contained in:
parent
4ba02e5881
commit
f0a93cca20
@ -53,12 +53,12 @@ func (app *Application) SavePlayer(usr *user.User, w http.ResponseWriter, r *htt
|
|||||||
|
|
||||||
func (app *Application) modifyUser(id string, gm *game.Game, name, authcode string) error {
|
func (app *Application) modifyUser(id string, gm *game.Game, name, authcode string) error {
|
||||||
if usr, err := app.GetUserByAuthcode(authcode); err == nil && usr.GetId() != id {
|
if usr, err := app.GetUserByAuthcode(authcode); err == nil && usr.GetId() != id {
|
||||||
return fmt.Errorf("authcode already in use")
|
return fmt.Errorf("%s authcode already in use", gm.GetId())
|
||||||
}
|
}
|
||||||
|
|
||||||
modifyUser := app.users[id]
|
modifyUser := app.users[id]
|
||||||
if modifyUser.GetId() != id || modifyUser.GetGameId() != gm.GetId() {
|
if modifyUser.GetId() != id || modifyUser.GetGameId() != gm.GetId() {
|
||||||
return fmt.Errorf("couldn't find player %s in game %s", id, gm.GetId())
|
return fmt.Errorf("%s couldn't find player %s in game", gm.GetId(), id)
|
||||||
}
|
}
|
||||||
modifyUser.SetName(name)
|
modifyUser.SetName(name)
|
||||||
modifyUser.SetAuthcode(authcode)
|
modifyUser.SetAuthcode(authcode)
|
||||||
@ -71,7 +71,7 @@ func (app *Application) modifyUser(id string, gm *game.Game, name, authcode stri
|
|||||||
|
|
||||||
func (app *Application) createUser(gm *game.Game, name, authcode string) error {
|
func (app *Application) createUser(gm *game.Game, name, authcode string) error {
|
||||||
if _, err := app.GetUserByAuthcode(authcode); err == nil {
|
if _, err := app.GetUserByAuthcode(authcode); err == nil {
|
||||||
return fmt.Errorf("authcode already in use")
|
return fmt.Errorf("%s authcode already in use", gm.GetId())
|
||||||
}
|
}
|
||||||
|
|
||||||
dirName := path.Join(app.config.DataDir, "users")
|
dirName := path.Join(app.config.DataDir, "users")
|
||||||
|
Loading…
Reference in New Issue
Block a user