示例#1
0
文件: FormAuth.cs 项目: Wykh/ARM
 private void btnLogIn_Click(object sender, EventArgs e)
 {
     using (var ctx = new UsersContext())
     {
         var user = ctx.awp_users.SingleOrDefault(us => us.login_ == tbLogin.Text);
         if (user != default)
         {
             var bsaltCurUser = user.salt;
             var rawPass      = tbPass.Text;
             var bpassCurUser = MetaBackEnd.CalcHash(MetaBackEnd.getCorrectPass(rawPass), bsaltCurUser);
             if (user.password.SequenceEqual(bpassCurUser))
             {
                 var roleId    = ctx.specials.Find(user.id_special).id_role;
                 var roleIndex = ctx.roles.Find(roleId).id;
                 var formAwp   = new FormAWP(roleIndex);
                 Hide();
                 if (formAwp.ShowDialog() == DialogResult.Cancel)
                 {
                     MessageBox.Show("Good bye");
                 }
                 tbLogin.Text = tbPass.Text = "";
                 Show();
             }
             else
             {
                 MessageBox.Show("Your password is wrong");
             }
         }
         else
         {
             MessageBox.Show("Your login is wrong");
         }
     }
 }
示例#2
0
文件: FormAuth.cs 项目: Wykh/ARM
        private void btnGuest_Click(object sender, EventArgs e)
        {
            var formAWP = new FormAWP(3);

            Hide();
            formAWP.ShowDialog();
            if (formAWP.DialogResult == DialogResult.No)
            {
                // change user
            }
            Show();
        }