Author: nhosoi
Update of /cvs/dirsec/admservconsole/src/com/netscape/management/admserv/panel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27220
Modified Files:
AccessConfigPanel.java
Log Message:
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.
Index: AccessConfigPanel.java
===================================================================
RCS file:
/cvs/dirsec/admservconsole/src/com/netscape/management/admserv/panel/AccessConfigPanel.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- AccessConfigPanel.java 22 May 2006 18:14:45 -0000 1.1.1.1
+++ AccessConfigPanel.java 10 Dec 2007 17:24:21 -0000 1.2
@@ -56,7 +56,7 @@
Help _help;
JCheckBox _cbDSGW;
- SingleByteTextField _txtUserName;
+ JLabel _lblUserName;
SingleBytePasswordField _txtPassword, _txtConfirm;
@@ -104,7 +104,6 @@
}
public void registerEditComponents(EditMonitor editMonitor) {
- editMonitor.monitor(_txtUserName);
editMonitor.monitor(_txtPassword);
editMonitor.monitor(_txtConfirm);
//editMonitor.monitor(_cbDSGW);
@@ -125,42 +124,27 @@
//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 @@
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);
Show replies by date