Exemplo n.º 1
0
        private void OnAuthenticationRequest(AuthenticationFeedbackArgs e)
        {
            var userInfo = (User)e.Client.Tag;

            string message = "";

            switch (e.Result)
            {
            case AuthenticationResult.Failed:
                message = " tried to log in with invalid password";
                break;

            case AuthenticationResult.Success:
                message = " successfuly logged in";
                m_serverHandler.NotifyAllAdmin(userInfo.Ip + " logged in", e.Client);
                break;

            case AuthenticationResult.RequestExpired:
                message = " tried to log in with expired salt";
                break;

            case AuthenticationResult.Error:
                message = " tried to log in, but an error occured";
                break;
            }

            logViewer.WriteLine(userInfo.Ip + message);
        }
Exemplo n.º 2
0
 void m_clientManager_OnLoggingFeedback(object sender, AuthenticationFeedbackArgs e)
 {
     if (InvokeRequired)
     {
         this.Invoke((MethodInvoker) delegate
         {
             OnLoggingFeedback(e);
         });
     }
     else
     {
         OnLoggingFeedback(e);
     }
 }
Exemplo n.º 3
0
 void m_serverHandler_OnAuthenticationRequest(object sender, AuthenticationFeedbackArgs e)
 {
     if (InvokeRequired)
     {
         this.Invoke((MethodInvoker) delegate
         {
             OnAuthenticationRequest(e);
         });
     }
     else
     {
         OnAuthenticationRequest(e);
     }
 }
Exemplo n.º 4
0
        private void OnLoggingFeedback(AuthenticationFeedbackArgs e)
        {
            if (e.Result == AuthenticationResult.Success)
            {
                ss_Status.Text = "Logged in successfully to " + m_clientManager.Ip + ":" + m_clientManager.Port;
                lgvConsole.WriteLine("Logged in successfully");
            }
            else
            {
                m_clientManager.Disconnect();
                ss_Status.Text = "Logging attempt failed at " + m_clientManager.Ip + ":" + m_clientManager.Port;

                if (e.Result == AuthenticationResult.Failed)
                {
                    lgvConsole.WriteLine("Logging attempt failed: Invalid username/password combination", MessageType.Error);
                }
                else if (e.Result == AuthenticationResult.RequestExpired)
                {
                    lgvConsole.WriteLine("Logging attempt failed: The request took too much time for the server. Please try again.", MessageType.Error);
                }
            }

            UpdateElementConnected();
        }