1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 09:24:21 +01:00

very small improvements on ppolicy.simple

This commit is contained in:
kakwa 2015-11-02 23:47:59 +01:00
parent 55cd8529c3
commit a74346f7a7

View File

@ -19,14 +19,14 @@ class PPolicy(ldapcherry.ppolicy.PPolicy):
def check(self, password):
if len(password) < self.min_length:
return {'match': False, 'reason': 'password too short'}
return {'match': False, 'reason': 'Password too short'}
if len(re.findall(r'[A-Z]', password)) < self.min_upper:
return {
'match': False,
'reason': 'not enough upper case characters'
'reason': 'Not enough upper case characters'
}
if len(re.findall(r'[0-9]', password)) < self.min_digit:
return {'match': False, 'reason': 'not enough digits'}
return {'match': False, 'reason': 'Not enough digits'}
return {'match': True, 'reason': 'password ok'}
def info(self):