Skip to content

Commit

Permalink
MID-9222: fix redirect to error page when principal is null on PageEm…
Browse files Browse the repository at this point in the history
…ailNonce
  • Loading branch information
skublik committed Oct 12, 2023
1 parent 4370649 commit 7a53810
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.Serial;

import com.evolveum.midpoint.gui.api.component.result.Toast;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.web.page.error.PageError;

import org.apache.wicket.RestartResponseException;
Expand Down Expand Up @@ -128,8 +129,13 @@ private void generateAndSendNonce(AjaxRequestTarget target) {

private void validateUserNotNullOrFail(UserType user) {
if (user == null) {
LOGGER.error("Couldn't find principal user, you probably use wrong configuration. "
+ "Please confirm order of authentication modules "
+ "and add module for identification of user before 'mailNonce' module, "
+ "for example 'focusIdentification' module.",
new IllegalArgumentException("principal user is null"));
getSession().error(getString("pageForgetPassword.message.user.not.found"));
throw new RestartResponseException(PageError.class);
throw new RestartResponseException(PageBase.class);
}
}

Expand Down

0 comments on commit 7a53810

Please sign in to comment.