Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string token = "";
            string pas   = textBox2.Text.Trim();
            string log   = textBox1.Text.Trim();

            if (Utill.validateLogin(log, pas))
            {
                User user = new User(log, pas);
                token = Utill.getHesh(log, pas);

                con.setInfo(textBox4.Text, textBox3.Text);
                con.getConnect();

                if (!checkBox1.Checked)
                {
                    con.sender(Utill.LOG + token);
                }
                else
                {
                    con.sender(Utill.NEW + Mapper.toString(user));
                }

                string answer = con.receiver();

                if (answer.Equals(Utill.CON))
                {
                    label1.Text      = "CONNECT";
                    label1.ForeColor = Color.Green;
                    Program.user     = user;
                    this.Hide();
                    form = new Form1();
                    form.StartPosition = this.StartPosition;
                    form.Show();
                }
                else if (answer.Equals(Utill.DIS))
                {
                    label1.Text      = "WRONG";
                    label1.ForeColor = Color.Red;
                }
            }
            else
            {
                label1.Text      = "INVALID";
                label1.ForeColor = Color.Yellow;
            }
        }
Exemple #2
0
 public User(string nickname, string password)
 {
     this.nickname = nickname;
     this.password = password;
     this.token    = Utill.getHesh(nickname, password);
 }