lichess-org / lila

♞ lichess.org: the forever free, adless and open source chess server ♞
https://lichess.org
GNU Affero General Public License v3.0
15.74k stars 2.28k forks source link

Starting game as an anonymous and continuing it as logged user is not working correctly #10404

Open wojtekweg opened 2 years ago

wojtekweg commented 2 years ago

First of all, I would like to note that I am not sure what is expected to happen under such circumstances. Although, for sure current behaviour seems to be misleading for end user and it should either be properly handled by allowing user to continue the game or blocking the possibility of making the moves.

Exact URL where the bug happened Any game URL

Steps to reproduce the bug Pre-conditions: having active player account on lichess.org

  1. Visit the lichess.org website being unlogged
  2. Start the game (Expected result: You are playing as an anonymous user)
  3. Login to your account and try to continue the game

What did you expect to happen? Hard to say - either blocking the possibility of move, if we say that's not the game that I should be allowed to play or make it possible to continue playing the game as logged in user that was started as anonymous

What happened instead? I am able to make moves and socket error is continuously logged in console and user sees "Reconnected" message in loop.

WebSocket error call stack:

H.send @ lichess.min.js:36
Ds.actualSendMove @ round.min.js:1
Ds.sendMove @ round.min.js:1
Ds.onUserMove @ round.min.js:1
(anonymous) @ round.min.js:1
setTimeout (async)
Mt @ round.min.js:1
At @ round.min.js:1
Et @ round.min.js:1
(anonymous) @ round.min.js:1
Qt @ round.min.js:1
Jt @ round.min.js:1
uo @ round.min.js:1
(anonymous) @ round.min.js:1

Operating system and browser version MacOS Monterey, Brave browser of version 1.33.106 based on Chromium: 96

https://user-images.githubusercontent.com/49337058/150008204-4e77c0ba-1939-4e4b-9cce-0222d89d0d77.mov

wojtekweg commented 2 years ago

Another interesting case is that in the following game: https://lichess.org/DGiST4i38xsG followed scenario was possible: 1. Started the game as anonymous (started game as whites) 2. Logged in to my account (ojtek) -> The very same WebSocket error was raised, couldn't make a move 3. Clicked "Resign" -> Game was aborted on my behalf, so I could finish the game, but I couldn't move

Never mind this case with resigning - as it turned out, the server allowed my oponent to claim the victory as I was no more online.

ornicar commented 2 years ago

You're not supposed to play an anonymous game as a registered player, that's for sure.

wojtekweg commented 2 years ago

Then the issue is that the interface is showing me that I am able to play a game, instead of displaying me the game as a spectator and there is a loop of WebSockets errors possible to trigger. So the severity of this issue is low, but I am leaving it open, since it seems to be a bug in user interface logic. Although feel free to close it, if you decide that it is not worth fixing