policies/password: fix symbols not being checked correctly

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-04 15:21:48 +02:00
parent 0c288ea64b
commit 37c29a073e
1 changed files with 2 additions and 3 deletions

View File

@ -70,9 +70,8 @@ class PasswordPolicy(Policy):
return PolicyResult(False, self.error_message) return PolicyResult(False, self.error_message)
if self.amount_symbols > 0: if self.amount_symbols > 0:
count = 0 count = 0
for symbol in self.symbol_charset.split(): for symbol in self.symbol_charset:
if symbol in password: count += password.count(symbol)
count += 1
if count < self.amount_symbols: if count < self.amount_symbols:
LOGGER.debug("password failed", reason="amount_symbols") LOGGER.debug("password failed", reason="amount_symbols")
return PolicyResult(False, self.error_message) return PolicyResult(False, self.error_message)