Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            ServiceSynchro.ServiceSynchroClient ssc = new ServiceSynchro.ServiceSynchroClient();
            ServiceSynchro.User[] Allusers          = ssc.GetUsers(false);

            string inputLogin = login.Text;
            //SOURCE
            string inputPassword = password.Text;

            password.Text = "";
            //HASH
            string inputPasswordMd5 = md5.CalculateMD5Hash(inputPassword).ToLower();
            bool   authen_state     = false;
            var    AllusersLength   = Allusers.GetLength(0);

            for (int iRow = 0; iRow < AllusersLength; iRow++)
            {
                if ((Allusers[iRow].Login == inputLogin) && ((Allusers[iRow].Password == inputPasswordMd5)))
                {
                    if (Allusers[iRow].Admin)
                    {
                        authen_state = true;
                        MenuAdmin fMenuAdmin = new MenuAdmin(Allusers[iRow].Id, ssc.CreateSynchro(Allusers[iRow].Id));
                        fMenuAdmin.Show();
                    }
                    else
                    {
                        authen_state = true;
                        Stock_user fStockUser = new Stock_user(Allusers[iRow].Id);
                        fStockUser.Show();
                    }
                }
            }
            if (!authen_state)
            {
                MessageBox.Show("L'authentification a échouée !");
            }
        }