mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-08-28 12:56:28 -04:00
pass_gen no longer recurses when the user gives invalid input
Former-commit-id: c9756093cd861911b7f5dc05a71fc5a8b858c17e [formerly b10c111640]
Former-commit-id: c8b7974ec39c4e114578314814c5c2a982339736
This commit is contained in:
+11
-6
@@ -117,12 +117,17 @@ def string_gen(_complexity, _length): # generates and returns a random string b
|
||||
|
||||
|
||||
def pass_gen(): # prompts the user for necessary information to generate a password and passes it to string_gen
|
||||
try:
|
||||
_length = int(input('password length: '))
|
||||
except ValueError:
|
||||
print(f"\n\u001b[38;5;9merror: a non-integer value was input for password length\u001b[0m\n")
|
||||
_gen = pass_gen()
|
||||
return _gen
|
||||
_length = 9
|
||||
while True:
|
||||
try:
|
||||
_length = int(input('password length: '))
|
||||
except ValueError:
|
||||
continue
|
||||
else:
|
||||
if _length < 1:
|
||||
continue
|
||||
else:
|
||||
break
|
||||
_complexity = str(input('password complexity - simple (for compatibility) or complex (for security)? (s/C) '))
|
||||
if _complexity != 's' and _complexity != 'S':
|
||||
_complexity = 'c'
|
||||
|
||||
Reference in New Issue
Block a user