diff --git a/README.md b/README.md new file mode 100644 index 0000000..2adee18 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# django3-password-generator + +* This is a web application made solely using the most popular web development for Python, that is, Django to generate new strong passwords. +* User is given the freedom to choose his password length, if he wants Upper Case characters, Special characters and Numbers. +* Additional functionality increases the password security by preventing the same characters to be added again and again. diff --git a/generator/views.py b/generator/views.py index d54ad5d..a512318 100644 --- a/generator/views.py +++ b/generator/views.py @@ -23,7 +23,13 @@ def password(request): length = int(request.GET.get('length',12)) thepassword = '' - for x in range(length): - thepassword += random.choice(characters) + x = 0 + while x < length: + charac = random.choice(characters) + if charac not in thepassword: + thepassword += charac + x += 1 + else: + continue return render(request, 'generator/password.html', {'password':thepassword})