Revision: 4047
Author: [email protected]
Date: Tue Dec 21 11:42:08 2010
Log: FIXED BUG 2946: Added in a confirm password field when creating new users.
http://code.google.com/p/power-architect/source/detail?r=4047

Modified:
/trunk/src/main/java/ca/sqlpower/architect/swingui/enterprise/SecurityPanel.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/enterprise/SecurityPanel.java Fri Oct 15 16:01:09 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/enterprise/SecurityPanel.java Tue Dec 21 11:42:08 2010
@@ -366,6 +366,7 @@
     private User createUserFromPrompter() {
         JTextField nameField = new JTextField(15);
         JTextField passField = new JPasswordField(15);
+        JTextField confirmField = new JPasswordField(15);

         JPanel namePanel = new JPanel(new BorderLayout());
         namePanel.add(new JLabel("User Name"), BorderLayout.WEST);
@@ -375,9 +376,13 @@
         passPanel.add(new JLabel("Password"), BorderLayout.WEST);
         passPanel.add(passField, BorderLayout.EAST);

+        JPanel confirmPanel = new JPanel(new BorderLayout());
+ confirmPanel.add(new JLabel("Confirm Password"), BorderLayout.WEST);
+        confirmPanel.add(confirmField, BorderLayout.EAST);
+
         Object[] messages = new Object[] {
                 "Specify the User's Name and Password.",
-                namePanel, passPanel};
+                namePanel, passPanel, confirmPanel};

         String[] options = { "OK", "Cancel",};
         int option = JOptionPane.showOptionDialog(getPanel(), messages,
@@ -390,6 +395,14 @@
                 || passField.getText() == null) {
             return null;
         }
+
+        if(!passField.getText().equals(confirmField.getText())) {
+            JOptionPane.showMessageDialog(getPanel(),
+                    "The passwords you entered do not match.",
+                    "Error",
+                    JOptionPane.ERROR_MESSAGE);
+            return null;
+        }

         User user = null;
         if (option == 0) {

Reply via email to