Skip to content

Commit

Permalink
Description of password fields (#2092)
Browse files Browse the repository at this point in the history
* add tooltips for password and confirm password fields in Credential dialogs

Signed-off-by: CT\pgoran <goran.palibrk@comtrade.com>

* add tooltips in change password dialog

Signed-off-by: CT\pgoran <goran.palibrk@comtrade.com>
  • Loading branch information
ct-goranpalibrk authored and Coduz committed Oct 10, 2018
1 parent 2a72318 commit 9fd17a9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
Expand Up @@ -11,9 +11,6 @@
*******************************************************************************/
package org.eclipse.kapua.app.console.core.client;

import com.extjs.gxt.ui.client.widget.form.TextField;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.eclipse.kapua.app.console.module.api.client.resources.icons.KapuaIcon;
import org.eclipse.kapua.app.console.module.api.client.ui.dialog.ActionDialog;
import org.eclipse.kapua.app.console.module.api.client.ui.dialog.SimpleDialog;
Expand All @@ -26,13 +23,19 @@
import org.eclipse.kapua.app.console.module.authentication.shared.service.GwtCredentialService;
import org.eclipse.kapua.app.console.module.authentication.shared.service.GwtCredentialServiceAsync;

import com.extjs.gxt.ui.client.widget.form.LabelField;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class ChangePasswordDialog extends SimpleDialog {

GwtCredentialServiceAsync credentialService = GWT.create(GwtCredentialService.class);

private TextField<String> oldPassword;
private TextField<String> newPassword;
private TextField<String> confirmPassword;
protected LabelField passwordTooltip;

private GwtSession currentSession;

Expand All @@ -43,7 +46,7 @@ public ChangePasswordDialog(GwtSession currentSession) {
@Override
public void createBody() {
FormPanel credentialFormPanel = new FormPanel(ActionDialog.FORM_LABEL_WIDTH);
DialogUtils.resizeDialog(this, 400, 200);
DialogUtils.resizeDialog(this, 400, 230);

oldPassword = new TextField<String>();
oldPassword.setAllowBlank(false);
Expand All @@ -68,6 +71,13 @@ public void createBody() {
confirmPassword.setPassword(true);
credentialFormPanel.add(confirmPassword);

passwordTooltip = new LabelField();
passwordTooltip.setValue(ActionDialog.MSGS.dialogAddTooltipCredentialPassword());
passwordTooltip.setStyleAttribute("margin-top", "-5px");
passwordTooltip.setStyleAttribute("color", "gray");
passwordTooltip.setStyleAttribute("font-size", "10px");
credentialFormPanel.add(passwordTooltip);

bodyPanel.add(credentialFormPanel);
}

Expand Down
Expand Up @@ -70,6 +70,7 @@ newPassword=New Password
confirmPassword=Confirm Password
changePasswordConfirmation=Password changed successfully!
changePasswordError=Error while changing password: {0}
dialogAddTooltipCredentialPassword=Password must be 12 to 255 characters long and must contain at least one lower case letter, one upper case letter, one digit and one special character.

apply=Apply
reset=Reset
Expand Down
Expand Up @@ -58,6 +58,7 @@ public class CredentialAddDialog extends EntityAddEditDialog {
protected KapuaDateField expirationDate;
SimpleComboBox<GwtCredentialStatus> credentialStatus;
NumberField optlock;
protected LabelField passwordTooltip;

static final GwtCredentialServiceAsync GWT_CREDENTIAL_SERVICE = GWT.create(GwtCredentialService.class);

Expand Down Expand Up @@ -85,7 +86,6 @@ public void createBody() {
credentialTypeLabel.setLabelSeparator(":");
credentialTypeLabel.setVisible(false);
credentialFormPanel.add(credentialTypeLabel);

credentialType = new SimpleComboBox<GwtCredentialType>();
credentialType.setEditable(false);
credentialType.setTypeAhead(false);
Expand All @@ -106,12 +106,19 @@ public void selectionChanged(SelectionChangedEvent<SimpleComboValue<GwtCredentia
confirmPassword.setAllowBlank(selectionChangedEvent.getSelectedItem().getValue() != GwtCredentialType.PASSWORD);
password.clearInvalid();
confirmPassword.clearInvalid();
if (password.isVisible() && confirmPassword.isVisible()) {
DialogUtils.resizeDialog(CredentialAddDialog.this, 400, 335);
passwordTooltip.show();
} else {
DialogUtils.resizeDialog(CredentialAddDialog.this, 400, 285);
passwordTooltip.hide();
}
if (selectionChangedEvent.getSelectedItem().getValue() != GwtCredentialType.PASSWORD) {
password.clear();
confirmPassword.clear();
confirmPassword.disable();
}
}
}
});
credentialFormPanel.add(credentialType);

Expand Down Expand Up @@ -150,6 +157,13 @@ public void handleEvent(BaseEvent be) {
}
});

passwordTooltip = new LabelField();
passwordTooltip.setValue(MSGS.dialogAddTooltipCredentialPassword());
passwordTooltip.setStyleAttribute("margin-top", "-5px");
passwordTooltip.setStyleAttribute("color", "gray");
passwordTooltip.setStyleAttribute("font-size", "10px");
credentialFormPanel.add(passwordTooltip);
passwordTooltip.hide();
expirationDate = new KapuaDateField();
expirationDate.setEmptyText(MSGS.dialogAddNoExpiration());
expirationDate.setFieldLabel(MSGS.dialogAddFieldExpirationDate());
Expand Down
Expand Up @@ -18,6 +18,7 @@
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.eclipse.kapua.app.console.module.api.client.util.DateUtils;
import org.eclipse.kapua.app.console.module.api.client.util.DialogUtils;
import org.eclipse.kapua.app.console.module.api.client.util.validator.ConfirmPasswordUpdateFieldValidator;
import org.eclipse.kapua.app.console.module.api.client.util.validator.PasswordUpdateFieldValidator;
import org.eclipse.kapua.app.console.module.api.shared.model.session.GwtSession;
Expand Down Expand Up @@ -90,6 +91,8 @@ private void loadCredential() {
expirationDate.setToolTip(MSGS.dialogAddFieldExpirationDateApiKeyTooltip());
credentialStatus.setToolTip(MSGS.dialogAddStatusApiKeyTooltip());
} else if (selectedCredential.getCredentialTypeEnum() == GwtCredentialType.PASSWORD) {
passwordTooltip.show();
DialogUtils.resizeDialog(CredentialEditDialog.this, 400, 335);
expirationDate.setToolTip(MSGS.dialogAddFieldExpirationDatePasswordTooltip());
credentialStatus.setToolTip(MSGS.dialogAddStatusPasswordTooltip());
}
Expand Down
Expand Up @@ -43,6 +43,7 @@ dialogAddFieldSubjectType=Subject Type
dialogAddFieldSubject=Username
dialogAddFieldPassword=Password
dialogAddFieldConfirmPassword=Confirm Password
dialogAddTooltipCredentialPassword=Password must be 12 to 255 characters long and must contain at least one lower case letter, one upper case letter, one digit and one special character.
dialogAddFieldExpirationDate=Expiration Date
dialogAddFieldExpirationDateTooltip=Set the expiration date for the credential. It should be in format DD/MM/YYYY.
dialogAddFieldExpirationDatePasswordTooltip=Set the expiration date for the password. It should be in format DD/MM/YYYY.
Expand Down

0 comments on commit 9fd17a9

Please sign in to comment.