Ejemplo n.º 1
0
        private void Login_Click(object sender, EventArgs e)
        {
            /*
             * var Email = email.Text;
             * var Password = password.Text;
             * var url = $"http://localhost:1337/login?email={email}&password={password}";
             * var request = WebRequest.Create(url);
             * var response = (HttpWebResponse)request.GetResponse();
             *
             * if (response.StatusCode == HttpStatusCode.OK)
             * {
             *  MessageBox.Show("пользователь авторизован");
             * }
             * else
             * {
             *  MessageBox.Show("Ошибка. Повторите ввод данных");
             * }
             */

            using (var ctx = new Database.ApplicationContext())
            {
                var user = ctx.Users.FirstOrDefault(it => it.Email == email.Text && it.Password == password.Text);


                if (user == null)
                {
                    Auth_Failed.Visible       = true;
                    email.LineFocusedColor    = Color.Red;
                    password.LineFocusedColor = Color.Red;
                    email.LineIdleColor       = Color.Red;
                    password.LineIdleColor    = Color.Red;
                    Recovery_button.Visible   = true;
                    return;
                }

                Cache.Add("user", user);
            }


            Preloader_Auth preloader = new Preloader_Auth();

            preloader.Show();
        }
Ejemplo n.º 2
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            Preloader_Auth preloader = new Preloader_Auth();

            preloader.Show();
        }