Skip to content

Commit

Permalink
MID-6015 fix: change password to the same value
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Mar 4, 2020
1 parent 3ec19f0 commit e66a596
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
Expand Up @@ -115,6 +115,8 @@ protected void onComponentTag(ComponentTag tag) {
protected void onUpdate(AjaxRequestTarget target) {
boolean required = !StringUtils.isEmpty(password1.getModelObject());
password2.setRequired(required);

changePasswordPerformed();
//fix of MID-2463
// target.add(password2);
// target.appendJavaScript("$(\"#"+ password2.getMarkupId() +"\").focus()");
Expand Down Expand Up @@ -322,4 +324,6 @@ public void setObject(String object) {
}
}
}

protected void changePasswordPerformed(){}
}
Expand Up @@ -9,6 +9,7 @@
import com.evolveum.midpoint.gui.api.factory.GuiComponentFactory;
import com.evolveum.midpoint.gui.impl.factory.ItemRealValueModel;
import com.evolveum.midpoint.gui.impl.prism.*;
import com.evolveum.midpoint.web.component.prism.ValueStatus;
import com.evolveum.midpoint.web.page.admin.users.PageUser;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;
import org.apache.wicket.Component;
Expand All @@ -31,17 +32,20 @@ public PasswordPropertyPanel(String id, IModel<PrismPropertyWrapper<ProtectedStr
protected Component createValuePanel(ListItem<PrismPropertyValueWrapper<ProtectedStringType>> item, GuiComponentFactory factory,
ItemVisibilityHandler visibilityHandler, ItemEditabilityHandler editabilityHandler) {

PasswordPanel passwordPanel;
// if (!(getPageBase() instanceof PageUser)) {
// passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new ItemRealValueModel<>(item.getModel()),
// getModelObject() != null && getModelObject().isReadOnly(), getModelObject() == null);

// } else {
//
passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new ItemRealValueModel<>(item.getModel()),
PasswordPanel passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new ItemRealValueModel<>(item.getModel()),
getModelObject() != null && getModelObject().isReadOnly(),
item.getModelObject() == null || item.getModelObject().getRealValue() == null );
// }
item.getModelObject() == null || item.getModelObject().getRealValue() == null ){
private static final long serialVersionUID = 1L;

@Override
protected void changePasswordPerformed(){
PrismPropertyValueWrapper<ProtectedStringType> itemModel = item.getModelObject();
if (itemModel != null){
itemModel.setStatus(ValueStatus.MODIFIED);
}
}

};
passwordPanel.setOutputMarkupId(true);
item.add(passwordPanel);
return passwordPanel;
Expand Down
Expand Up @@ -25,8 +25,6 @@ public class ProtectedStringTypeWrapperImpl extends PrismPropertyWrapperImpl<Pro

public ProtectedStringTypeWrapperImpl(PrismContainerValueWrapper<?> parent, PrismProperty<ProtectedStringType> item, ItemStatus status) {
super(parent, item, status);

// getItem().setRealValue(null);
}

@Override
Expand Down

0 comments on commit e66a596

Please sign in to comment.