private void logOutToolStripMenuItem_Click(object sender, EventArgs e) { try { UserCtx.Logout(ref uctx); InitialHideComponents(); } catch (System.Security.SecurityException se) { MessageBox.Show("Permission denied " + se.Message); } catch (Exception se) { MessageBox.Show(se.Message); } label1.Text = "Not logged in"; this.listBox1.Items.Clear(); this.listBox2.Items.Clear(); }
private void zalogujToolStripMenuItem_Click(object sender, EventArgs e) { var logging = new Login(); var result = logging.ShowDialog(); if (result == DialogResult.OK) { string username = logging.ReturnValue1; //values preserved after close string password = logging.ReturnValue2; bool loggingResult = UserCtx.Login(username, password, out _userCtx); ShowComponents(_userCtx); if (!loggingResult) { MessageBox.Show("Błąd logowania: nieprawidłowy login lub hasło. \nSpróbuj ponownie"); } if (!_userCtx.HasRoleRight(Operation.Admin)) { MessageBox.Show("Użytkownik nie posiada praw administratora"); UserCtx.Logout(ref _userCtx); } } }
private void wylogujToolStripMenuItem_Click(object sender, EventArgs e) { UserCtx.Logout(ref _userCtx); }