@@ -9,7 +9,7 @@ def passwordValidator():
9
9
print ('\n Your password should: ' )
10
10
print ('\t - Have a minimum length of 6;' )
11
11
print ('\t - Have a maximum length of 12;' )
12
- print ('\t - Contain at least an uppercase letter or a lowercase letter' )
12
+ print ('\t - Contain at least an uppercase letter and a lowercase letter; ' )
13
13
print ('\t - Contain at least a number;' )
14
14
print ('\t - Contain at least a special character (such as @,+,£,$,%,*^,etc);' )
15
15
print ('\t - Not contain space(s).' )
@@ -24,9 +24,13 @@ def passwordValidator():
24
24
if ' ' in userPassword :
25
25
message = 'Invalid Password..your password shouldn\' t contain space(s)'
26
26
return message
27
- if not any (i in string .ascii_letters for i in userPassword ):
27
+ if not any (i in string .ascii_letters . upper () for i in userPassword ):
28
28
message = 'Invalid Password..your password should contain at least '
29
- message += 'an uppercase letter and a lowercase letter'
29
+ message += 'an uppercase letter'
30
+ return message
31
+ if not any (i in string .ascii_letters .lower () for i in userPassword ):
32
+ message = 'Invalid Password..your password should contain at least '
33
+ message += 'a lowercase letter'
30
34
return message
31
35
if not any (i in string .digits for i in userPassword ):
32
36
message = 'Invalid Password..your password should contain at least a number'
@@ -38,4 +42,4 @@ def passwordValidator():
38
42
return 'Valid Password!'
39
43
40
44
my_password = passwordValidator ()
41
- print (my_password )
45
+ print (my_password )
0 commit comments