From 6f3c43aca62a7d33a19f14f6ad7c16891952673a Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 15 Sep 2026 19:55:21 -0400 Subject: fix: outstanding-stake ledger, owner backpressure, editor state preservation --- internal/game/core_login_account.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (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 a846f4d..fbd9e3a 100644 --- a/internal/game/core_login_account.go +++ b/internal/game/core_login_account.go @@ -2,6 +2,7 @@ package game import ( "fmt" + "log" "strings" "thehouseoficarus/internal/color" @@ -62,6 +63,19 @@ func (g *Game) handlePassword(sess *net.Session, input string) { sess.Write("Account name: ") return } + // Transparent upgrade: legacy single-pass SHA-256 hashes rehash to + // Argon2id after a successful verification. A failed save keeps the + // legacy hash and retries on the next login. + if player.NeedsRehash(acc.PasswordHash) { + if hash, hashErr := player.HashPassword(input); hashErr == nil { + acc.PasswordHash = hash + if err := g.AccountStore.SaveAccount(acc); err != nil { + log.Printf("login: password rehash save for %s: %v", acc.Name, err) + } + } else { + log.Printf("login: password rehash for %s: %v", acc.Name, hashErr) + } + } sess.Conn.SetEcho(true) sess.Account = &player.Account{ Name: acc.Name, -- cgit v1.2.3