예제 #1
0
        private void loadData()
        {
            floatingWindow.setContextMenuStrip(dataMenu);
            checkSelectedItems();

            LSPMDatabase database         = new LSPMDatabase(Properties.Settings.Default.pwdHash);
            LiteCollection <LSPMData> col = database.getDBCollection();

            col.EnsureIndex(x => x.lAlias);

            credentials = col.FindAll().ToList();

            credsView.Clear();
            dataMenu.Items.Clear();
            foreach (LSPMData data in credentials)
            {
                bool         addSeparator = false;
                ListViewItem a            = new ListViewItem(data.lAlias);
                a.ImageIndex = ( int )data.lDataIcon;
                credsView.Items.Add(a);

                ToolStripMenuItem mSup = new ToolStripMenuItem(data.lAlias, icons.Images[(int)data.lDataIcon]);
                mSup.BackColor = Color.FromArgb(33, 33, 33);

                mSup.ForeColor = Color.FromArgb(100, 200, 255);
                mSup.Font      = new System.Drawing.Font("Segoe UI Semibold", 11.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));

                if (data.lUserFastAccess)
                {
                    LSPMMenuItem tItem = new LSPMMenuItem("Usuario", Properties.Resources.user, data.lUser, TaskbarHandler);
                    tItem.BackColor = Color.FromArgb(33, 33, 33);
                    mSup.DropDownItems.Add(tItem);
                    addSeparator = true;
                }
                if (data.lPasswordFastAccess)
                {
                    LSPMMenuItem tItem = new LSPMMenuItem("Clave", Properties.Resources.key, data.lPass, TaskbarHandler);
                    tItem.BackColor = Color.FromArgb(33, 33, 33);
                    mSup.DropDownItems.Add(tItem);
                    addSeparator = true;
                }
                if (data.lPasswordFastAccess || data.lUserFastAccess)
                {
                    dataMenu.Items.Add(mSup);
                }
                //if ( addSeparator ) dataMenu.Items.Add( new ToolStripSeparator() );
            }
            dataMenu.Items.Add(toolStripSeparator1);
            dataMenu.Items.Add(generarPass);
            dataMenu.Items.Add(mostrarLSPMToolStripMenuItem);
            dataMenu.Items.Add(salirToolStripMenuItem);
        }
예제 #2
0
        private void deleteCredsButton_Click(object sender, EventArgs e)
        {
            string alias = credsView.SelectedItems[0].Text;

            if (MessageBox.Show("¿Realmente desea eliminar la información seleccionada?", "¿Eliminar?", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                LSPMDatabase database         = new LSPMDatabase(Properties.Settings.Default.pwdHash);
                LiteCollection <LSPMData> col = database.getDBCollection();
                col.EnsureIndex(x => x.lAlias);

                col.Delete(x => x.lAlias.Equals(alias));
                loadData();
            }
        }
예제 #3
0
        private bool validatePwd(string pwd)
        {
            bool result = false;

            if (LSPMDatabase.hashString(pwd) == Properties.Settings.Default.pwdHash)
            {
                result = true;
            }
            else
            {
                MessageBox.Show("La contraseña es incorrecta", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(result);
        }
예제 #4
0
        private void clearDB()
        {
            LSPMDatabase database         = new LSPMDatabase(Properties.Settings.Default.pwdHash);
            LiteCollection <LSPMData> col = database.getDBCollection();

            col.EnsureIndex(x => x.lAlias);
            List <LSPMData> credentials = col.FindAll().ToList();

            foreach (LSPMData data in credentials)
            {
                col.Delete(data.Id);
            }
            DialogResult = DialogResult.OK;
            Close();
        }
예제 #5
0
        public editDataForm(string alias)
        {
            InitializeComponent();

            db = new LSPMDatabase(Properties.Settings.Default.pwdHash);
            LiteDB.LiteCollection <LSPMData> col = db.getDBCollection();

            col.EnsureIndex(x => x.lAlias);
            editable = col.FindOne(x => x.lAlias.Equals(alias));

            aliasInput.Text             = editable.lAlias;
            userInput.Text              = editable.lUser;
            passwordInput.Text          = editable.lPass;
            userAccessCheck.Checked     = editable.lUserFastAccess;
            passwordAccessCheck.Checked = editable.lPasswordFastAccess;
            markColor(editable.lDataIcon);
        }
예제 #6
0
파일: LSPMStart.cs 프로젝트: 1337luis/LSPM
        private void startButton_Click(object sender, EventArgs e)
        {
            if (passwordInput1.Text == "" || passwordInput2.Text == "")
            {
                MessageBox.Show("La contraseña no puede estar vacía", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (passwordInput1.Text != passwordInput2.Text)
            {
                MessageBox.Show("Las contraseñas no coinciden", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Properties.Settings.Default.pwdHash = LSPMDatabase.hashString(passwordInput1.Text);
                Properties.Settings.Default.Save();
                LSPMDatabase ndb = new LSPMDatabase(Properties.Settings.Default.pwdHash);
                ndb.getDBCollection().Insert(new LSPMData("admin", "1234", "Acceso Prueba", true, true));

                DialogResult = DialogResult.OK;
                Close();
            }
        }
예제 #7
0
 private void newDataForm_Load(object sender, EventArgs e)
 {
     db = new LSPMDatabase(Properties.Settings.Default.pwdHash);
 }