Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Apr 3, 2020
2 parents 90fd936 + 8076e70 commit 02ca4c4
Show file tree
Hide file tree
Showing 15 changed files with 1,008 additions and 937 deletions.

Large diffs are not rendered by default.

Expand Up @@ -11,7 +11,9 @@
import java.util.ArrayList;
import java.util.List;

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.xml.ns._public.common.common_3.CredentialsPropagationUserControlType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordChangeSecurityType;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;

Expand All @@ -24,6 +26,9 @@ public class MyPasswordsDto implements Serializable {
public static final String F_PASSWORD = "password";
public static final String F_OLD_PASSWORD = "oldPassword";


private PrismObject<? extends FocusType> focus;

private List<PasswordAccountDto> accounts;
private ProtectedStringType password;
private CredentialsPropagationUserControlType propagation;
Expand Down Expand Up @@ -68,4 +73,16 @@ public String getOldPassword() {
public void setOldPassword(String oldPassword) {
this.oldPassword = oldPassword;
}

public PrismObject<? extends FocusType> getFocus() {
return focus;
}

public void setFocus(PrismObject<? extends FocusType> focus) {
this.focus = focus;
}

public String getFocusOid() {
return focus.getOid();
}
}
Expand Up @@ -6,6 +6,9 @@
*/
package com.evolveum.midpoint.web.page.forgetpassword;

import com.evolveum.midpoint.web.application.Url;
import com.evolveum.midpoint.web.page.admin.home.dto.MyPasswordsDto;
import com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;

import org.apache.wicket.ajax.AjaxRequestTarget;
Expand All @@ -26,13 +29,20 @@
import com.evolveum.midpoint.web.page.self.PageSelf;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;

@PageDescriptor(url = PageResetPassword.URL, action = {
@AuthorizationAction(actionUri = PageSelf.AUTH_SELF_ALL_URI,
label = PageSelf.AUTH_SELF_ALL_LABEL,
description = PageSelf.AUTH_SELF_ALL_DESCRIPTION),
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_SELF_CREDENTIALS_URL,
label = "PageSelfCredentials.auth.credentials.label",
description = "PageSelfCredentials.auth.credentials.description")})
import java.util.Collections;
import java.util.List;

@PageDescriptor(
urls = {
@Url(mountUrl = PageResetPassword.URL, matchUrlForSecurity = PageResetPassword.URL)
},
action = {
@AuthorizationAction(actionUri = PageSelf.AUTH_SELF_ALL_URI,
label = PageSelf.AUTH_SELF_ALL_LABEL,
description = PageSelf.AUTH_SELF_ALL_DESCRIPTION),
@AuthorizationAction(actionUri = AuthorizationConstants.AUTZ_UI_SELF_CREDENTIALS_URL,
label = "PageSelfCredentials.auth.credentials.label",
description = "PageSelfCredentials.auth.credentials.description")})
public class PageResetPassword extends PageAbstractSelfCredentials{

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -62,7 +72,8 @@ protected void finishChangePassword(final OperationResult result, AjaxRequestTar
result.setMessage(getString("PageResetPassword.reset.successful"));
setResponsePage(PageLogin.class);

PrismObject<? extends FocusType> focus = getFocus();
MyPasswordsDto passwords = getModelObject();
PrismObject<? extends FocusType> focus = passwords.getFocus();
if (focus == null) {
SecurityContextHolder.getContext().setAuthentication(null);
return;
Expand Down Expand Up @@ -97,5 +108,24 @@ protected void createBreadcrumb() {
// we don't want breadcrumbs here
}

@Override
protected boolean shouldLoadAccounts(MyPasswordsDto dto) {
return false;
}

@Override
protected List<PasswordAccountDto> getSelectedAccountsList() {
List<PasswordAccountDto> accounts = getModelObject().getAccounts();
if (accounts.isEmpty()) {
return Collections.EMPTY_LIST;
}

for (PasswordAccountDto account : accounts) {
if (account.isMidpoint()) {
return Collections.singletonList(account);
}
}

return accounts;
}
}

0 comments on commit 02ca4c4

Please sign in to comment.