Example #1
0
        private void Button2_Click(object sender, EventArgs e)
        {
            try
            {
                string felhasznaloNevHash = Titkositasok.SHAHash(textBox1.Text.Trim() + Konstans.salt);
                if (ABKezelo.CountUsers(felhasznaloNevHash) != 0)
                {
                    string       jelszoEmlekeztetoOTP = ABKezelo.getJelszoHash(felhasznaloNevHash);
                    Titkositasok t      = new Titkositasok();
                    string       jelszo = t.f0(felhasznaloNevHash, jelszoEmlekeztetoOTP, KodolasIranya.Dekódol);

                    if (jelszo != "" && jelszo[0] != 0)
                    {
                        MessageBox.Show("The password remainder: " + jelszo, "Information", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                    else
                    {
                        throw new WarningException("There is no such username or not set password remainder!");
                    }
                }
                else
                {
                    throw new WarningException("There is no such username or not set password remainder!");
                }
            }
            catch (Exception ex)
            {
                if (ex is WarningException)
                {
                    MessageBox.Show(ex.Message, "Attention!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }