mirror of
https://codeberg.org/andyscott/password-generator-cli.git
synced 2024-11-09 06:00:50 -05:00
Merge pull request 'Use python's secrets class to generate more secure passwords' (#1) from agileDesigner/password-generator-cli:main into main
Reviewed-on: https://codeberg.org/acscott-personal/password-generator-cli/pulls/1
This commit is contained in:
commit
c80d3cc0c5
1 changed files with 3 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
import random
|
import secrets
|
||||||
|
|
||||||
class PasswordGenerator():
|
class PasswordGenerator():
|
||||||
"""
|
"""
|
||||||
|
@ -68,14 +68,11 @@ class PasswordGenerator():
|
||||||
possible characters that should be considered and generates the
|
possible characters that should be considered and generates the
|
||||||
password.
|
password.
|
||||||
"""
|
"""
|
||||||
password = ''
|
|
||||||
self.use_upper()
|
self.use_upper()
|
||||||
self.use_nums()
|
self.use_nums()
|
||||||
self.use_symbols()
|
self.use_symbols()
|
||||||
while len(password) < self._length:
|
password = ''.join(secrets.choice(self._available_chars) for i in range(self._length))
|
||||||
password += random.choice(self._available_chars)
|
print('\nYour new password is: ', password+'\n')
|
||||||
print('\nYour new password is: ', password)
|
|
||||||
print('\n')
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue