{"action":"created","issue":{"url":"https://api.github.com/repos/Cardshifter/Cardshifter/issues/347","labels_url":"https://api.github.com/repos/Cardshifter/Cardshifter/issues/347/labels{/name}","comments_url":"https://api.github.com/repos/Cardshifter/Cardshifter/issues/347/comments","events_url":"https://api.github.com/repos/Cardshifter/Cardshifter/issues/347/events","html_url":"https://github.com/Cardshifter/Cardshifter/issues/347","id":99848182,"number":347,"title":"Handle failed login","user":{"login":"jacwah","id":3816754,"avatar_url":"https://avatars.githubusercontent.com/u/3816754?v=3","gravatar_id":"","url":"https://api.github.com/users/jacwah","html_url":"https://github.com/jacwah","followers_url":"https://api.github.com/users/jacwah/followers","following_url":"https://api.github.com/users/jacwah/following{/other_user}","gists_url":"https://api.github.com/users/jacwah/gists{/gist_id}","starred_url":"https://api.github.com/users/jacwah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacwah/subscriptions","organizations_url":"https://api.github.com/users/jacwah/orgs","repos_url":"https://api.github.com/users/jacwah/repos","events_url":"https://api.github.com/users/jacwah/events{/privacy}","received_events_url":"https://api.github.com/users/jacwah/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Cardshifter/Cardshifter/labels/server","name":"server","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-09T00:38:45Z","updated_at":"2015-08-18T13:09:28Z","closed_at":null,"body":"The server can choose to respond with success or 404 when a client sends a login command. Currently the reason the server might send a failure response is if the user name starts with an \"x\". I don''t know why this is, but guess it's for testing. The server will get a real reason for refusing logins with @Phrancis' proposed solution to #345.\r\n\r\nThe expected behavior when a login is refused is that the server closes the connection after sending an error response back. This should in turn lead to the client showing an error on the login screen prompting the user to try another user name.\r\n\r\n![Screenshot of client after login is refused](http://i.imgur.com/5WGverq.png)\r\n\r\nCurrently the client reacts in a curious way. The lobby is opened with logged in users showing, but without the chat area.\r\n\r\n**Client log**\r\n```\r\n[2015-08-09 02:17:50,301]  INFO GameClientLobby [JavaFX Application Thread] (  GameClientLobby.java:147) - Sending: {\"command\":\"login\",\"username\":\"xjacwah\"}\r\n[2015-08-09 02:17:50,306]  INFO GameClientLobby [JavaFX Application Thread] (  GameClientLobby.java:147) - Sending: {\"command\":\"query\",\"request\":\"USERS\",\"message\":\"\"}\r\n[2015-08-09 02:17:50,407]  INFO GameClientLobby [JavaFX Application Thread] (  GameClientLobby.java:167) - WelcomeMessage [status=404, userId=0, message=Wrong username or password]\r\n[2015-08-09 02:17:50,407]  INFO GameClientLobby [JavaFX Application Thread] (  GameClientLobby.java:167) - UserStatusMessage [userId=2, status=ONLINE, name=AI Loser]\r\n[2015-08-09 02:17:50,408]  INFO GameClientLobby [JavaFX Application Thread] (  GameClientLobby.java:167) - UserStatusMessage [userId=3, status=ONLINE, name=AI Idiot]\r\n[2015-08-09 02:17:50,408]  INFO GameClientLobby [JavaFX Application Thread] (  GameClientLobby.java:167) - UserStatusMessage [userId=4, status=ONLINE, name=AI Medium]\r\n[2015-08-09 02:17:50,409]  INFO GameClientLobby [JavaFX Application Thread] (  GameClientLobby.java:167) - UserStatusMessage [userId=5, status=ONLINE, name=AI Fighter]\r\n[2015-08-09 02:17:50,409]  INFO GameClientLobby [JavaFX Application Thread] (  GameClientLobby.java:167) - UserStatusMessage [userId=7, status=ONLINE, name=]\r\n```\r\n\r\n**Server log**\r\n```\r\n[2015-08-09 02:17:50,304]  INFO   Handlers [    Conn-0] (         Handlers.java: 67) - Login request: xjacwah for client 7:  @ /127.0.0.1:56419\r\n[2015-08-09 02:17:50,304]  INFO Log4jAdapter [    Conn-0] (     Log4jAdapter.java: 16) - Send to : WelcomeMessage [status=404, userId=0, message=Wrong username or password]\r\n[2015-08-09 02:17:50,308]  INFO ClientSocketHandler [    Conn-0] (ClientSocketHandler.java: 89) - Received from 7:  @ /127.0.0.1:56419: ServerQueryMessage: Request USERS message: \r\n[2015-08-09 02:17:50,308]  INFO Log4jAdapter [    Conn-0] (     Log4jAdapter.java: 16) - Send to : UserStatusMessage [userId=2, status=ONLINE, name=AI Loser]\r\n[2015-08-09 02:17:50,309]  INFO Log4jAdapter [    Conn-0] (     Log4jAdapter.java: 16) - Send to : UserStatusMessage [userId=3, status=ONLINE, name=AI Idiot]\r\n[2015-08-09 02:17:50,309]  INFO Log4jAdapter [    Conn-0] (     Log4jAdapter.java: 16) - Send to : UserStatusMessage [userId=4, status=ONLINE, name=AI Medium]\r\n[2015-08-09 02:17:50,309]  INFO Log4jAdapter [    Conn-0] (     Log4jAdapter.java: 16) - Send to : UserStatusMessage [userId=5, status=ONLINE, name=AI Fighter]\r\n[2015-08-09 02:17:50,309]  INFO Log4jAdapter [    Conn-0] (     Log4jAdapter.java: 16) - Send to : UserStatusMessage [userId=7, status=ONLINE, name=]\r\n```"},"comment":{"url":"https://api.github.com/repos/Cardshifter/Cardshifter/issues/comments/132200392","html_url":"https://github.com/Cardshifter/Cardshifter/issues/347#issuecomment-132200392","issue_url":"https://api.github.com/repos/Cardshifter/Cardshifter/issues/347","id":132200392,"user":{"login":"Zomis","id":1405379,"avatar_url":"https://avatars.githubusercontent.com/u/1405379?v=3","gravatar_id":"","url":"https://api.github.com/users/Zomis","html_url":"https://github.com/Zomis","followers_url":"https://api.github.com/users/Zomis/followers","following_url":"https://api.github.com/users/Zomis/following{/other_user}","gists_url":"https://api.github.com/users/Zomis/gists{/gist_id}","starred_url":"https://api.github.com/users/Zomis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zomis/subscriptions","organizations_url":"https://api.github.com/users/Zomis/orgs","repos_url":"https://api.github.com/users/Zomis/repos","events_url":"https://api.github.com/users/Zomis/events{/privacy}","received_events_url":"https://api.github.com/users/Zomis/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T13:09:28Z","updated_at":"2015-08-18T13:09:28Z","body":"Related to another issue with some clients showing the lobby even if the server is down (won't look for it at the moment, or I have just been dreaming this...). **Clients should not switch to the lobby screen until they receive the 200 status**. If they receive another status, they should just show the provided message to the user."}}