Ejemplo n.º 1
0
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            UserListBox.Items.Add("trying to login" + "\n");
            string auth         = Encrypt(Convert.ToString(DateTime.Now), password.Text);
            string returnString = Server.KLogin(username.Text, auth);

            UserListBox.Items.Add("authenticator being sent is : " + auth + "\n");
            if (returnString == "")
            {
                username.Text = "";
                password.Text = "";
                MessageBox.Show("error in logging in");
                UserListBox.Items.Add("error in authenticating" + "\n");
            }
            else
            {
                //MessageBox.Show(returnString);
                username.Text   = "";
                password.Text   = "";
                tgt             = returnString;
                Login.IsEnabled = false;
                UserListBox.Items.Add("logged in" + "\n");
                UserListBox.Items.Add("tgt is : " + tgt + "\n");
                string path = "c:\\Users\\Public\\KerbTrayTGT.txt";

                FileStream   fs = new FileStream(path, FileMode.Create, FileAccess.Write);
                StreamWriter sw = new StreamWriter(fs);

                sw.WriteLine(tgt);
                sw.Flush();
                sw.Close();
                fs.Close();
            }

            /*if(returnValue == 1 )
             * {
             *
             * }
             *
             * else if(returnValue == 0)
             * {
             *
             *  MessageBox.Show("logged in");
             *  WelcomeText.Content = "Welcome" + username.Text;
             *  username.IsEnabled = false;
             *  Login.IsEnabled = false;
             *  LoadUserList(Server.GetCurrentUsers());
             * }*/
        }