mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-23 00:03:53 +02:00
support old password prompting in change password dialog
This commit is contained in:
parent
19c06ef7ae
commit
560175bd3a
1 changed files with 41 additions and 2 deletions
|
@ -43,8 +43,10 @@ public class SystemChangePasswordDialog extends SystemPromptDialog
|
||||||
{
|
{
|
||||||
private String _hostname;
|
private String _hostname;
|
||||||
private String _user;
|
private String _user;
|
||||||
|
private String _oldPassword = ""; // $NON_NLS-1$
|
||||||
private String _newPassword = ""; //$NON-NLS-1$
|
private String _newPassword = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private Text _txtOldPassword;
|
||||||
private Text _txtNewPassword;
|
private Text _txtNewPassword;
|
||||||
private Text _txtConfirmPassword;
|
private Text _txtConfirmPassword;
|
||||||
|
|
||||||
|
@ -54,6 +56,8 @@ public class SystemChangePasswordDialog extends SystemPromptDialog
|
||||||
private boolean newPasswordModified = false;
|
private boolean newPasswordModified = false;
|
||||||
private boolean confirmModified = false;
|
private boolean confirmModified = false;
|
||||||
|
|
||||||
|
private boolean _promptForOldPassword = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new SystemChangePasswordDialog. Since this dialog is asking for a new password
|
* Construct a new SystemChangePasswordDialog. Since this dialog is asking for a new password
|
||||||
* there is no need to supply the old password, however a remote system will usually require
|
* there is no need to supply the old password, however a remote system will usually require
|
||||||
|
@ -72,10 +76,20 @@ public class SystemChangePasswordDialog extends SystemPromptDialog
|
||||||
setErrorMessage(msg);
|
setErrorMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void promptForOldPassword(boolean flag)
|
||||||
|
{
|
||||||
|
_promptForOldPassword = flag;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see SystemPromptDialog#getInitialFocusControl()
|
* @see SystemPromptDialog#getInitialFocusControl()
|
||||||
*/
|
*/
|
||||||
protected Control getInitialFocusControl() {
|
protected Control getInitialFocusControl()
|
||||||
|
{
|
||||||
|
if (_promptForOldPassword)
|
||||||
|
{
|
||||||
|
return _txtOldPassword;
|
||||||
|
}
|
||||||
return _txtNewPassword;
|
return _txtNewPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +127,17 @@ public class SystemChangePasswordDialog extends SystemPromptDialog
|
||||||
userID.setToolTipText(SystemResources.RESID_PREF_SIGNON_USERID_TOOLTIP);
|
userID.setToolTipText(SystemResources.RESID_PREF_SIGNON_USERID_TOOLTIP);
|
||||||
((GridData) userID.getLayoutData()).widthHint = 75;
|
((GridData) userID.getLayoutData()).widthHint = 75;
|
||||||
|
|
||||||
|
if (_promptForOldPassword)
|
||||||
|
{
|
||||||
|
// Old password
|
||||||
|
label = new Label(c, SWT.NONE);
|
||||||
|
label.setText(SystemResources.RESID_CHANGE_PASSWORD_OLD_LABEL);
|
||||||
|
_txtOldPassword = SystemWidgetHelpers.createTextField(c, null);
|
||||||
|
_txtOldPassword.setEchoChar('*');
|
||||||
|
_txtOldPassword.setToolTipText(SystemResources.RESID_CHANGE_PASSWORD_OLD_TOOLTIP);
|
||||||
|
((GridData) _txtOldPassword.getLayoutData()).widthHint = 75;
|
||||||
|
}
|
||||||
|
|
||||||
// New password
|
// New password
|
||||||
label = new Label(c, SWT.NONE);
|
label = new Label(c, SWT.NONE);
|
||||||
label.setText(SystemResources.RESID_CHANGE_PASSWORD_NEW_LABEL);
|
label.setText(SystemResources.RESID_CHANGE_PASSWORD_NEW_LABEL);
|
||||||
|
@ -181,6 +206,11 @@ public class SystemChangePasswordDialog extends SystemPromptDialog
|
||||||
String newPassword = _txtNewPassword.getText().trim();
|
String newPassword = _txtNewPassword.getText().trim();
|
||||||
String confirmPassword = _txtConfirmPassword.getText().trim();
|
String confirmPassword = _txtConfirmPassword.getText().trim();
|
||||||
|
|
||||||
|
if (_promptForOldPassword)
|
||||||
|
{
|
||||||
|
_oldPassword = _txtOldPassword.getText().trim();
|
||||||
|
}
|
||||||
|
|
||||||
if (!newPassword.equals(confirmPassword))
|
if (!newPassword.equals(confirmPassword))
|
||||||
{
|
{
|
||||||
return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_MISMATCH);
|
return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_MISMATCH);
|
||||||
|
@ -205,6 +235,15 @@ public class SystemChangePasswordDialog extends SystemPromptDialog
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The old password set by the user or null if the
|
||||||
|
* cancel button was pressed or if no old password prompt is displayed.
|
||||||
|
*/
|
||||||
|
public String getOldPassword()
|
||||||
|
{
|
||||||
|
return _oldPassword;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The new password set by the user or null if the
|
* @return The new password set by the user or null if the
|
||||||
* cancel button was pressed.
|
* cancel button was pressed.
|
||||||
|
|
Loading…
Add table
Reference in a new issue