From d652fff0c3c49fa14c45af59c8c5279f3a6e60d5 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Dec 10 2007 17:24:21 +0000 Subject: Resolves: #416311 Summary: Admin Console: change admin user text field to label Description: Username value is a text field. By default, it is "admin" and it is the uid attribute value of admin entry. It can be changed (e.g., newadmin), but the uid attribute value is not touched. This causes both "newadmin" and "admin" can be used to login, which is confusing. Since uid attribute value is not modified together, there is no much sense to allow the username modifiable. changing the type to label. --- diff --git a/src/com/netscape/management/admserv/panel/AccessConfigPanel.java b/src/com/netscape/management/admserv/panel/AccessConfigPanel.java index 0a62057..a583dc0 100644 --- a/src/com/netscape/management/admserv/panel/AccessConfigPanel.java +++ b/src/com/netscape/management/admserv/panel/AccessConfigPanel.java @@ -56,7 +56,7 @@ public class AccessConfigPanel extends PluginConfigPanel implements SuiConstants Help _help; JCheckBox _cbDSGW; - SingleByteTextField _txtUserName; + JLabel _lblUserName; SingleBytePasswordField _txtPassword, _txtConfirm; @@ -104,7 +104,6 @@ public class AccessConfigPanel extends PluginConfigPanel implements SuiConstants } public void registerEditComponents(EditMonitor editMonitor) { - editMonitor.monitor(_txtUserName); editMonitor.monitor(_txtPassword); editMonitor.monitor(_txtConfirm); //editMonitor.monitor(_cbDSGW); @@ -125,42 +124,27 @@ public class AccessConfigPanel extends PluginConfigPanel implements SuiConstants //String dsgw = (_cbDSGW.isSelected()) ? "on" : "off"; //data.setAttribute(AttrNames.CONFIG_DSGW, dsgw); - String newuid = _txtUserName.getText(); String newpw1 = _txtPassword.getText(); String newpw2 = _txtConfirm.getText(); String olduid = _configData.getAttribute(AttrNames.ADMPW_UID); - if (newuid.length() == 0) { - throw new ValidationException("", _i18nMsgEnterUID); - } - // User name changed - else if (!olduid.equals(newuid)) { - if (newpw1.length() == 0) { - throw new ValidationException("", _i18nMsgEnterPWD); - } else if (!newpw1.equals(newpw2)) { + // check if password changed + if (newpw1.length() != 0) { + if (!newpw1.equals(newpw2)) { throw new ValidationException("", _i18nMsgPWDMismatch); } - } else { // check if password changed - if (newpw1.length() != 0) { - if (!newpw1.equals(newpw2)) { - throw new ValidationException("", _i18nMsgPWDMismatch); - } - } } - if (! newuid.equals(olduid)) { - Debug.println("CHANGE UID TO " + newuid); - _configData.setAttribute(AttrNames.ADMPW_UID, newuid); - } if (newpw1.length() > 0) { - Debug.println("CHANGE PWD "); + Debug.println("CHANGE PWD TO " + newpw1); _configData.setAttribute(AttrNames.ADMPW_PWD, newpw1); } } private void setUserName(String name) { - _txtUserName.setText((name == null) ? "" : name); + _lblUserName.setText((name == null) ? "" : name); + _lblUserName.repaint(); } @@ -208,13 +192,14 @@ public class AccessConfigPanel extends PluginConfigPanel implements SuiConstants GBC.NONE); //fill group.add(uidLabel, gbc); - _txtUserName = new SingleByteTextField(16); + // Changed from textfield to a label whose contents is fetched by the CGI + _lblUserName = new JLabel("."); // will be overridden gbc.setInsets(0, DIFFERENT_COMPONENT_SPACE, 0, 0); gbc.setGrid(1, 0, 1, 1); gbc.setSpace(0.0, 0.0, GBC.WEST, // anchor GBC.HORIZONTAL); //fill - group.add(_txtUserName, gbc); - uidLabel.setLabelFor(_txtUserName); + group.add(_lblUserName, gbc); + uidLabel.setLabelFor(_lblUserName); JLabel pwdLabel = new JLabel(_i18nPWD); gbc.setInsets(COMPONENT_SPACE, 0, 0, 0);