Пример #1
0
        protected void LogIn(object sender, EventArgs e)
        {
            getHash    hash    = new getHash(Email.Text);
            checkEmail compare = new checkEmail(Email.Text);

            if (compare.check_if_correct(Email.Text))
            {
                HttpCookie welcome = new HttpCookie("welcome");
                welcome["user"] = Email.Text;
                Response.Cookies.Add(welcome);

                Response.Redirect("Member.aspx");
            }
        }
Пример #2
0
        public string validaEmail(string email)
        {
            checkEmail ckEmail   = new checkEmail();
            string     localTemp = "";

            localTemp = validaDigitacao(email, "email");
            if (!localTemp.Equals(""))
            {
                return(localTemp);
            }

            if (!ckEmail.validaEmailEstrutura(email))
            {
                return("E-mail invalido!");
            }
            if (!checkInput(email))
            {
                return("O E-mail possui caracteres invalidos!");
            }
            return("");
        }
Пример #3
0
        private async Task process_login()
        {
            string password_text = password.Password;
            string email         = login.Text;

            Task process = Task.Factory.StartNew(() =>
            {
                checkEmail input = new checkEmail(email);
                if (input.check_if_correct(email))
                {
                    //Need to add presisent setting so that user login can be retrieved at a later point
                    Properties.Settings.Default.user_login = email;
                    getHash hpass = new getHash(email);

                    if (BCrypt.Net.BCrypt.Verify(password_text, hpass.hashValue))
                    {
                        Application.Current.Dispatcher.Invoke(delegate
                        {
                            //your code
                            Products window_product = new Products();
                            window_product.Show();
                            this.Close();
                        });
                    }
                    else
                    {
                        MessageBox.Show($"Login is incorrect. Please try again!");
                    }
                }
                else
                {
                    MessageBox.Show($"Login is incorrect. Please try again!");
                }
            });
            await process;
        }