diff options
| author | historia <[not public]> | 2026-09-15 19:55:21 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-15 19:55:21 -0400 |
| commit | 6f3c43aca62a7d33a19f14f6ad7c16891952673a (patch) | |
| tree | 0b0665ef624ef442df87ec7131129aaecc3420bd /internal/game/core_login_account.go | |
| parent | cd95de60364aba8f5bdf8ec86f7234a9903eacc8 (diff) | |
| download | thehouseoficarus-6f3c43aca62a7d33a19f14f6ad7c16891952673a.tar.gz | |
fix: outstanding-stake ledger, owner backpressure, editor state preservation
Diffstat (limited to 'internal/game/core_login_account.go')
| -rw-r--r-- | internal/game/core_login_account.go | 14 |
1 files changed, 14 insertions, 0 deletions
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, |
