From 0fb0700ced4a5189cfe52c1bf8c070c4ec527bff Mon Sep 17 00:00:00 2001 From: Ritik Garg <53874982+rooky1905@users.noreply.github.com> Date: Fri, 2 Oct 2020 20:47:42 +0530 Subject: [PATCH 1/2] Made the passwords more secure. Added additional functionality which prevents repeated addition of same character which may be caused by random function. This functionality increases the password quality. --- generator/views.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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}) From 75e79a24226e3d14b984c38b3ed1214129b0a6a1 Mon Sep 17 00:00:00 2001 From: Ritik Garg <53874982+rooky1905@users.noreply.github.com> Date: Fri, 2 Oct 2020 20:51:31 +0530 Subject: [PATCH 2/2] Create README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 README.md 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.