From ca669ae54f86dbeea277280690584d9f591c7571 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 18 Feb 2015 07:26:26 +0000
Subject: [PATCH] AutoRefactor: collapse if statements
---
opendj-server-legacy/src/main/java/org/opends/server/extensions/DictionaryPasswordValidator.java | 25 ++++++++++---------------
1 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DictionaryPasswordValidator.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DictionaryPasswordValidator.java
index ee5bacc..3391e30 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DictionaryPasswordValidator.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DictionaryPasswordValidator.java
@@ -132,14 +132,12 @@
// the password which is the default behaviour ('check-substrings: false')
int minSubstringLength = password.length();
- if (config.isCheckSubstrings())
+ if (config.isCheckSubstrings()
+ // We apply the minimal substring length only if the provided value
+ // is smaller then the actual password length
+ && config.getMinSubstringLength() < password.length())
{
- // We apply the minimal substring length only if the provided value
- // is smaller then the actual password length
- if (config.getMinSubstringLength() < password.length())
- {
- minSubstringLength = config.getMinSubstringLength();
- }
+ minSubstringLength = config.getMinSubstringLength();
}
// Verify if the dictionary contains the word(s) in the password
@@ -152,15 +150,12 @@
// If the reverse password checking is enabled, then verify if the
// reverse value of the password is in the dictionary.
- if (config.isTestReversedPassword())
+ if (config.isTestReversedPassword()
+ && isDictionaryBased(
+ new StringBuilder(password).reverse().toString(), minSubstringLength))
{
- if (isDictionaryBased(
- new StringBuilder(password).reverse().toString(), minSubstringLength))
- {
- invalidReason.append(
- ERR_DICTIONARY_VALIDATOR_PASSWORD_IN_DICTIONARY.get());
- return false;
- }
+ invalidReason.append(ERR_DICTIONARY_VALIDATOR_PASSWORD_IN_DICTIONARY.get());
+ return false;
}
--
Gitblit v1.10.0