Esempio n. 1
0
        protected void btn_register_Click(object sender, EventArgs e)
        {
            //Pick to use xmlAuth as embedded or as service.
            xmlAuthServ.IauthClient _registration = new xmlAuthServ.IauthClient();
            //xmlAuth _registration = new xmlAuth();

            CryptionFunctions _crypt = new CryptionFunctions();

            try
            {
                int result =
                    Convert.ToInt32(_registration.Registeration(tb_register_user.Text, "*****@*****.**",
                                                                _crypt.Encrypt(tb_register_pw.Text, true)));
                String encryptedPw = _crypt.Encrypt(tb_register_pw.Text, true);
                if (result == 1)
                {
                    lbl_register_output.Text = String.Format("User {0} was saved with password {1}.", tb_register_user.Text,
                                                             encryptedPw);
                }
                else if (result == 0)
                {
                    lbl_register_output.Text =
                        "That user already exists. There have been lots of test users added so please try a new one";
                }
                else
                {
                    lbl_register_output.Text = "Please try again";
                }
            }
            catch
            {
                lbl_register_output.Text = "Please try again";
            }
        }
Esempio n. 2
0
        protected void btn_login_Click(object sender, EventArgs e)
        {
            //Pick between embedded component and service.
            xmlAuthServ.IauthClient _login = new xmlAuthServ.IauthClient();
            //xmlAuth _login = new xmlAuth();

            CryptionFunctions _crypt = new CryptionFunctions();

            try
            {
                int result = Convert.ToInt32(_login.Login(tb_login_user.Text, _crypt.Encrypt(tb_login_pw.Text, true)));
                if (result == 0)
                {
                    lbl_login_output.Text = "User Name Does Not Exist";
                }
                else if (result == 1)
                {
                    lbl_login_output.Text = "Successful Login";
                }
                else if (result == 2)
                {
                    lbl_login_output.Text = "Password is Invalid";
                }
                else
                {
                    lbl_login_output.Text = "Something Went Wrong. Try Again Please";
                }
            }
            catch
            {
                lbl_login_output.Text = "Something Went Wrong. Try Again Please";
            }
        }
Esempio n. 3
0
 protected void btn_decrypt_Click(object sender, EventArgs e)
 {
     try
     {
         CryptionFunctions _crypt       = new CryptionFunctions();
         String            strToDecrypt = tb_decrypt.Text;
         String            result       = _crypt.Decrypt(strToDecrypt, true);
         lbl_decryptOut.Text = result;
     }
     catch
     {
         lbl_decryptOut.Text = "Please Try Again.";
     }
 }