Exemple #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            AuthenticationMethods.Username = txtUsername.Text;
            AuthenticationMethods.Password = txtPassword.Text;

            // Test authentication:
            AuthenticationMethods.IsAuthenticated = _serviceCalls.CheckAuthentication();
            if (AuthenticationMethods.IsAuthenticated)
            {
                this.Close();
            }
            else
            {
                MessageBox.Show("Authentication failed. Please check your credentials and try again.");
            }
        }
Exemple #2
0
 private void CheckAuthentication(bool onAppInitialized)
 {
     if (!onAppInitialized)
     {
         AuthenticationMethods.IsAuthenticated = _serviceCalls.CheckAuthentication();
     }
     if (AuthenticationMethods.IsAuthenticated)
     {
         btnAuth.Visible    = false;
         btnRefresh.Visible = true;
         lblStatus.Text     = $"Logged in as {AuthenticationMethods.Username}";
         menuStrip1.Visible = true;
         BindPolicyGrid();
     }
     else
     {
         btnAuth.Visible    = true;
         btnRefresh.Visible = false;
         lblStatus.Text     = "You are not logged in. Please log in to begin.";
         menuStrip1.Visible = false;
         //ShowLoginForm();
     }
 }