Пример #1
0
 private void cmdRemoveUser_Click(object sender, RoutedEventArgs e)
 {
     if (Bouncer.UserNames.Contains(txtAccountUserName.Text))
     {
         MessageBox thisBox = new MessageBox(this, "Are you sure you want to remove the account " + txtAccountUserName.Text + "?", "Account Manager");
         thisBox.addButton("Cancel", delegate() { });
         thisBox.addButton("Remove", () => { Bouncer.removeAccount(txtAccountUserName.Text); updateNames(); });
         thisBox.Show();
     }
     else
     {
         new MessageBox("The user specified could not be found.", "Error").Show();
     }
 }
Пример #2
0
 private void cmdAddUser_Click(object sender, RoutedEventArgs e)
 {
     if (txtAccountUserName.Text.Length > 1 && txtAccountPassword.Password.Length > 1)
     {
         if (Bouncer.addAccount(txtAccountUserName.Text, txtAccountPassword.Password))
         {
             updateNames();
         }
         else
         {
             new MessageBox("You cannot have two users with the same account name.", "Error").Show();
         }
     }
 }
Пример #3
0
 private void procedureAuthenticate(HttpRequest request, HttpResponse response)
 {
     if (request.postValues.ContainsKey(HTML_USERNAME_TEXT_ID) && request.postValues.ContainsKey(HTML_PASSWORD_TEXT_ID))
     {
         string username = request.postValues[HTML_USERNAME_TEXT_ID];
         if (Bouncer.validateCredentials(username, System.Net.WebUtility.UrlDecode(request.postValues[HTML_PASSWORD_TEXT_ID])))
         {
             HttpAuth.allowClient(client, username);
             response.addHeader("Location", "/controllers");
             return;
         }
     }
     response = new HttpResponse(HttpResponse.ConnectionStatus.FORBIDDEN, "keep-alive", null);
     response.addHeader("Content-Length", "0");
 }