mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-08-31 22:36:31 -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
|
def pass_gen(): # prompts the user for necessary information to generate a password and passes it to string_gen
|
||||||
try:
|
_length = 9
|
||||||
_length = int(input('password length: '))
|
while True:
|
||||||
except ValueError:
|
try:
|
||||||
print(f"\n\u001b[38;5;9merror: a non-integer value was input for password length\u001b[0m\n")
|
_length = int(input('password length: '))
|
||||||
_gen = pass_gen()
|
except ValueError:
|
||||||
return _gen
|
continue
|
||||||
|
else:
|
||||||
|
if _length < 1:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
break
|
||||||
_complexity = str(input('password complexity - simple (for compatibility) or complex (for security)? (s/C) '))
|
_complexity = str(input('password complexity - simple (for compatibility) or complex (for security)? (s/C) '))
|
||||||
if _complexity != 's' and _complexity != 'S':
|
if _complexity != 's' and _complexity != 'S':
|
||||||
_complexity = 'c'
|
_complexity = 'c'
|
||||||
|
|||||||
Reference in New Issue
Block a user