/// <summary> /// Send a "You need to authenticate yourself." error followed by the /// welcome message. /// </summary> /// <param name="socket"></param> private void TellClientToReAuthenticate(AsyncSocket socket) { MessageAuthenticationResponse response = new MessageAuthenticationResponse(false); response.ErrorMessage = "You need to authenticate yourself."; SendMessageToClient(response, socket, true); SendMessageToClient(welcomeMessage, socket, true); }
private void SendAuthenticationResponse(AsyncSocket socket, bool _success) { MessageAuthenticationResponse authResponse = new MessageAuthenticationResponse(_success); if (!_success) { authResponse.ErrorMessage = "Login failed"; } else { WifiRemote.LogMessage("Client identified: " + socket.GetRemoteClient().ToString(), WifiRemote.LogType.Debug); string key = getRandomMD5(); authResponse.AutologinKey = key; loginTokens.Add(new AutoLoginToken(key, socket.GetRemoteClient())); } SendMessageToClient(authResponse, socket, true); }