GetPassword() public static method

Gets the decrypted password of a specified profile
public static GetPassword ( int id ) : string
id int Profile ID
return string
示例#1
0
        /// <summary>
        /// Login based on selected item on the form
        /// </summary>
        private void Login()
        {
            try
            {
                if (SelectedItem < 0)
                {
                    return;
                }

                Cursor = Cursors.WaitCursor;
                ListViewItem item = lvAccounts.Items[lvAccounts.SelectedIndices[0]];

                CurrentSettingsProfile =
                    string.IsNullOrEmpty(item.SubItems[3].Text)
                        ? ""
                        : item.SubItems[3].Text;

                // fire event to load settings before logging in so we log into user's project/wiki
                if (CurrentSettingsProfile.Length > 0 && UserDefaultSettingsLoadRequired != null)
                {
                    UserDefaultSettingsLoadRequired(null, null);
                }

                if (item.SubItems[2].Text == "Yes")
                {
                    //Get 'Saved' Password
                    PerformLogin(AWBProfiles.GetPassword(int.Parse(item.Text)));
                }
                else
                {
                    //Get Password from User
                    UserPassword password = new UserPassword
                    {
                        Username = item.SubItems[1].Text
                    };

                    if (password.ShowDialog(this) == DialogResult.OK)
                    {
                        PerformLogin(password.GetPassword);
                    }
                }

                AWBProfiles.LastUsedAccount = item.Text;

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                ErrorHandler.HandleException(ex);
            }
        }
示例#2
0
        /// <summary>
        /// Login based on selected item on the form
        /// </summary>
        private void Login()
        {
            try
            {
                if (SelectedItem < 0)
                {
                    return;
                }

                Cursor = Cursors.WaitCursor;
                CurrentSettingsProfile =
                    string.IsNullOrEmpty(lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text)
                        ? ""
                        : lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text;

                if (lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[2].Text == "Yes")
                {
                    //Get 'Saved' Password
                    PerformLogin(AWBProfiles.GetPassword(int.Parse(lvAccounts.Items[lvAccounts.SelectedIndices[0]].Text)));
                }
                else
                {
                    //Get Password from User
                    UserPassword password = new UserPassword
                    {
                        Username = lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[1].Text
                    };

                    if (password.ShowDialog(this) == DialogResult.OK)
                    {
                        PerformLogin(password.GetPassword);
                    }
                }

                AWBProfiles.LastUsedAccount = lvAccounts.Items[lvAccounts.SelectedIndices[0]].Text;

                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                ErrorHandler.Handle(ex);
            }
        }
示例#3
0
        /// <summary>
        /// Login based on selected item on the form
        /// </summary>
        private void login()
        {
            try
            {
                if (SelectedItem < 0)
                {
                    return;
                }

                Cursor = Cursors.WaitCursor;
                if (!string.IsNullOrEmpty(lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text))
                {
                    CurrentSettingsProfile = lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[3].Text;
                }
                else
                {
                    CurrentSettingsProfile = "";
                }

                if (lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[2].Text == "Yes")
                {//Get 'Saved' Password
                    browserLogin(AWBProfiles.GetPassword(int.Parse(lvAccounts.Items[lvAccounts.SelectedIndices[0]].Text)));
                }
                else
                {//Get Password from User
                    UserPassword password = new UserPassword();
                    password.SetText = "Enter password for " + lvAccounts.Items[lvAccounts.SelectedIndices[0]].SubItems[1].Text;

                    if (password.ShowDialog() == DialogResult.OK)
                    {
                        browserLogin(password.GetPassword);
                    }
                }
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);
            }
        }