private void OnAutorizeRequest(string message) { _user = MessageAnalyserHelper.GetServerUserFromString(message); if (_user.Username.Length < 3) { SendServerResponse(ServerMesageHeader.UsernameOrPasswordIncorrect); Dispose(); return; } if (DataBaseManager.GetInstance().VerifyUser(_user)) { Authorize(); } else { SendServerResponse(ServerMesageHeader.UsernameOrPasswordIncorrect); Dispose(); } }
private void OnRegisterRequest(string message) { _user = MessageAnalyserHelper.GetServerUserFromString(message); if (_user.Username.Length < 3) { SendServerResponse(ServerMesageHeader.UsernameOrPasswordIncorrect); Dispose(); return; } if (!DataBaseManager.GetInstance().CheckUserExistance(_user)) { DataBaseManager.GetInstance().AddUserToDataBase(_user); Authorize(); } else { SendServerResponse(ServerMesageHeader.UserExist); Dispose(); } }