From 9192d94dea6be5498ab080f3e2df5667af871d7a Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 16 Sep 2026 14:41:15 -0400 Subject: fix: casino room eviction, session close race fix, open-payout recovery evidence --- internal/game/core_login_account.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'internal/game/core_login_account.go') diff --git a/internal/game/core_login_account.go b/internal/game/core_login_account.go index c5f1064..1acd1a6 100644 --- a/internal/game/core_login_account.go +++ b/internal/game/core_login_account.go @@ -20,7 +20,7 @@ func (g *Game) handleAccountName(sess *net.Session, input string) { if err == nil { sess.Account = &player.Account{Name: actualName} sess.State = net.StatePassword - sess.Conn.SetEcho(false) + sess.SetEcho(false) sess.Write("Password: ") } else { if verr := player.ValidName(name); verr != nil { @@ -30,7 +30,7 @@ func (g *Game) handleAccountName(sess *net.Session, input string) { } sess.Account = &player.Account{Name: name} sess.State = net.StateNewAccountPass - sess.Conn.SetEcho(false) + sess.SetEcho(false) sess.WriteLine("\r\nOh, a new visitor to this rock!") sess.Write("Choose password: ") } @@ -42,7 +42,7 @@ func (g *Game) handlePassword(sess *net.Session, input string) { return } if len(input) > 128 { - sess.Conn.SetEcho(true) + sess.SetEcho(true) sess.WriteLine("Wrong password.") sess.State = net.StateAccountName sess.Write("Account name: ") @@ -50,14 +50,14 @@ func (g *Game) handlePassword(sess *net.Session, input string) { } acc, err := g.AccountStore.LoadAccount(sess.Account.Name) if err != nil { - sess.Conn.SetEcho(true) + sess.SetEcho(true) sess.WriteLine("Error loading account.") sess.State = net.StateAccountName sess.Write("Account name: ") return } if !player.CheckPassword(input, acc.PasswordHash) { - sess.Conn.SetEcho(true) + sess.SetEcho(true) sess.WriteLine("Wrong password.") sess.State = net.StateAccountName sess.Write("Account name: ") @@ -76,7 +76,7 @@ func (g *Game) handlePassword(sess *net.Session, input string) { log.Printf("login: password rehash for %s: %v", acc.Name, hashErr) } } - sess.Conn.SetEcho(true) + sess.SetEcho(true) sess.Account = &player.Account{ Name: acc.Name, PasswordHash: acc.PasswordHash, @@ -101,7 +101,7 @@ func (g *Game) handlePassword(sess *net.Session, input string) { func (g *Game) handleNewPass(sess *net.Session, input string) { input = strings.TrimSpace(input) if input == "" { - sess.Conn.SetEcho(true) + sess.SetEcho(true) sess.Account = nil sess.State = net.StateAccountName sess.Write("Account name: ") @@ -120,14 +120,14 @@ func (g *Game) handleNewPass(sess *net.Session, input string) { func (g *Game) handleNewAccount(sess *net.Session, input string) { input = strings.TrimSpace(input) if input == "" { - sess.Conn.SetEcho(true) + sess.SetEcho(true) sess.Account = nil sess.State = net.StateAccountName sess.Write("Account name: ") return } if input != sess.PendingPass { - sess.Conn.SetEcho(true) + sess.SetEcho(true) sess.WriteLine("Passwords do not match.") sess.Account = nil sess.State = net.StateAccountName @@ -137,7 +137,7 @@ func (g *Game) handleNewAccount(sess *net.Session, input string) { hash, err := player.HashPassword(input) if err != nil { - sess.Conn.SetEcho(true) + sess.SetEcho(true) sess.WriteLine(fmt.Sprintf("Error creating account: %v", err)) sess.Account = nil sess.State = net.StateAccountName @@ -150,7 +150,7 @@ func (g *Game) handleNewAccount(sess *net.Session, input string) { // the admin API) may have created it in the meantime; saving without // this check would overwrite that account's password and characters. if _, findErr := g.AccountStore.FindAccount(sess.Account.Name); findErr == nil { - sess.Conn.SetEcho(true) + sess.SetEcho(true) sess.Account = nil sess.State = net.StateAccountName sess.WriteLine("That account name was just taken; please sign in instead.") @@ -163,7 +163,7 @@ func (g *Game) handleNewAccount(sess *net.Session, input string) { PasswordHash: hash, } if err := g.AccountStore.SaveAccount(acc); err != nil { - sess.Conn.SetEcho(true) + sess.SetEcho(true) sess.WriteLine(fmt.Sprintf("Error creating account: %v", err)) sess.Account = nil sess.State = net.StateAccountName @@ -171,7 +171,7 @@ func (g *Game) handleNewAccount(sess *net.Session, input string) { return } - sess.Conn.SetEcho(true) + sess.SetEcho(true) sess.Account = &player.Account{ Name: acc.Name, PasswordHash: acc.PasswordHash, -- cgit v1.2.3