Ejemplo n.º 1
0
 /// <summary>
 /// Verifies the password in the text box is valid, prompts the user, then closes the window if successful.
 /// </summary>
 private void changePassword()
 {
     // If you want requirements for passwords, (such as 8 characters in length, etc.) implement it here.
     if ((codeBox.Text.Trim() == "") || (codeBox2.Text.Trim() == ""))
     {
         MPAiMessageBoxFactory.Show("Passwords should not be empty!",
                                    "Oops", MPAiMessageBoxButtons.OK);
     }
     else if (codeBox.Text != codeBox2.Text)
     {
         MPAiMessageBoxFactory.Show("Passwords do not match!",
                                    "Oops", MPAiMessageBoxButtons.OK);
     }
     else if (codeBox.Text.Equals(currentUser.getCode()))
     {
         MPAiMessageBoxFactory.Show("That is already your password!",
                                    "Oops", MPAiMessageBoxButtons.OK);
     }
     else
     {
         UserManagement.ChangeCurrentUserCode(codeBox.Text);
         UserManagement.WriteSettings();
         MPAiMessageBoxFactory.Show("Password changed! ",
                                    "Done", MPAiMessageBoxButtons.OK);
         Close();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Automatically enters a username and password into the correct text boxes.
        /// </summary>
        /// <param name="Username">The username to enter, as a string.</param>
        /// <param name="Password">The password to enter, as a string.</param>
        public void VisualizeUser(MPAiUser user)
        {
            if (!(user == null))
            {
                watermarkUsername(true);
                usernameTextBox.Text = user.getName();

                watermarkPassword(true);
                passwordTextBox.Text = user.getCode();
            }
        }