Пример #1
0
        private void userDelBtn_Click(object sender, EventArgs e)
        {
            UserSecurity.User user = (UserSecurity.User)usersBinding.Current;
            InfoBox           ib   = new InfoBox();

            if (user.Login == UserSecurity.CurrentUser.Login)
            {
                ib.Icon = MessageBoxIcon.Error;
                ib.Show("You cannot delete yourself!");

                return;
            }

            DialogResult ans;

            ib.Type    = InfoBoxType.SuperConfirmBox;
            ib.Icon    = MessageBoxIcon.Warning;
            ib.Buttons = MessageBoxButtons.YesNo;

            ans = ib.Show("You are about to delete the user \"{0}\".\r" +
                          "This operation cannot be undone.\r\r" +
                          "Continue anyway?",
                          user.Login);

            if (ans == DialogResult.Yes)
            {
                try
                {
                    UserSecurity.Users.Remove(user);
                    UserSecurity.Users.Save();
                }
                catch (Exception ex)
                {
                    ib = new InfoBox();

                    ib.Icon = MessageBoxIcon.Error;
                    ib.Show("Save Error:\r{0}", ex.Message);
                }
            }
        }
Пример #2
0
        private void okBtn_Click(object sender, EventArgs e)
        {
            string npass = newPassTxt.Text.Trim();
            string cpass = confPassTxt.Text.Trim();

            if (npass != "")
            {
                if (npass != cpass)
                {
                    InfoBox ib = new InfoBox();

                    ib.Icon = MessageBoxIcon.Error;
                    ib.Show("New and confirmation passwords do not match.");

                    return;
                }

                m_user.Password = npass;
            }

            try
            {
                m_user.Save();
            }
            catch (Exception ex)
            {
                InfoBox ib = new InfoBox();

                ib.Icon = MessageBoxIcon.Error;
                ib.Show("Error Saving:\n{0}", ex.Message);

                return;
            }

            DialogResult = DialogResult.OK;
        }
Пример #3
0
        private void initLists()
        {
            // Make sure we have at least one site to chose from.
            if (m_sites.Count == 0)
            {
                InfoBox ib = new InfoBox();

                ib.Icon = MessageBoxIcon.Exclamation;
                ib.Show("There are no sites to log into!");

                return;
            }

            // Load sites into site drop down.
            siteSelList.Properties.Items.AddRange(m_sites);
            int lastSel = 0;

            if (m_sites.Count > 1)
            {
                Int32.TryParse(SCOUT.Core.Data.Helpers.Config["LastSiteIdx"], out lastSel);
            }

            siteSelList.SelectedIndex = lastSel;
        }
Пример #4
0
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (!m_forced)
            {
                /*
                 * Check if forced because we fill in bogus info
                 * on the forced version.
                 */
                if (m_user.Password != oldTxt.Text)
                {
                    InfoBox ib = new InfoBox();

                    ib.Icon = MessageBoxIcon.Error;
                    ib.Show("Old password incorrect.");

                    return;
                }
            }

            string npass = newTxt.Text.Trim();
            string cpass = confirmTxt.Text.Trim();

            if (npass == String.Empty)
            {
                InfoBox ib = new InfoBox();

                ib.Icon = MessageBoxIcon.Error;
                ib.Show("A password is required.");

                newTxt.Focus();
                return;
            }

            if (npass != cpass)
            {
                InfoBox ib = new InfoBox();

                ib.Show("New and confirm passwords do not match.");

                return;
            }

            if (npass == m_user.Password)
            {
                InfoBox ib = new InfoBox();

                ib.Show("New and old passwords must be different.");

                return;
            }

            m_user.Password        = npass;
            m_user.ForcePassChange = false;

            try
            {
                m_user.Save();
                MessageBox.Show("Password changed.", Application.ProductName, MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                Close();
            }
            catch (Exception ex)
            {
                InfoBox ib = new InfoBox();

                ib.Icon = MessageBoxIcon.Error;
                ib.Show(ex.Message);

                if (!m_forced)
                {
                    return;
                }
            }

            DialogResult = DialogResult.OK;
        }