Esempio n. 1
0
        public void DoLogin(object sender, EventArgs e)
        {
            try
            {
                var pwdHash       = HashSHA512(password.Text);
                var pwdHashOrigin = DataBaseHelper.GetUserPwdHash(email.Text);

                if (!String.IsNullOrEmpty(pwdHashOrigin) &&
                    pwdHashOrigin == pwdHash)
                {
                    Toast.MakeText(this, "Login successfully done!", ToastLength.Long).Show();
                    StartActivity(typeof(MainActivity));
                }
                else
                {
                    Toast.MakeText(this, "Wrong credentials found!", ToastLength.Long).Show();
                }
                password.Text = "";
            }
            catch (MySqlException)
            {
                Toast.MakeText(this, "Could not connect to database server", ToastLength.Long).Show();
                StartActivity(typeof(ServerPrefs));
            }
        }