Skip to content

Commit

Permalink
fix showing error on LoginPage
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Jun 29, 2021
1 parent a980320 commit fc400b3
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ public boolean isVisible() {
return false;
}

if (finalSecurityPolicy != null && finalSecurityPolicy.getCredentialsReset() != null
&& StringUtils.isNotBlank(finalSecurityPolicy.getCredentialsReset().getAuthenticationSequenceName())) {
AuthenticationSequenceType sequence = SecurityUtils.getSequenceByName(finalSecurityPolicy.getCredentialsReset().getAuthenticationSequenceName(), finalSecurityPolicy.getAuthentication());
if (sequence != null
&& (sequence.getChannel() == null || StringUtils.isBlank(sequence.getChannel().getUrlSuffix()))){
return false;
}
}

CredentialsPolicyType creds = finalSecurityPolicy.getCredentials();

// TODO: Not entirely correct. This means we have reset somehow configured, but not necessarily enabled.
Expand All @@ -106,10 +115,11 @@ public boolean isVisible() {
&& StringUtils.isNotBlank(securityPolicy.getCredentialsReset().getAuthenticationSequenceName())) {
AuthenticationSequenceType sequence = SecurityUtils.getSequenceByName(securityPolicy.getCredentialsReset().getAuthenticationSequenceName(), securityPolicy.getAuthentication());
if (sequence != null) {
// throw new IllegalArgumentException("Couldn't find sequence with name " + securityPolicy.getCredentialsReset().getAuthenticationSequenceName());

if (sequence.getChannel() == null || StringUtils.isBlank(sequence.getChannel().getUrlSuffix())) {
throw new IllegalArgumentException("Sequence with name " + securityPolicy.getCredentialsReset().getAuthenticationSequenceName() + " doesn't contain urlSuffix");
String message = "Sequence with name " + securityPolicy.getCredentialsReset().getAuthenticationSequenceName() + " doesn't contain urlSuffix";
LOGGER.error(message, new IllegalArgumentException(message));
error(message);
}
link.add(AttributeModifier.replace("href", new IModel<String>() {
@Override
Expand Down

0 comments on commit fc400b3

Please sign in to comment.