#๐ a password analysis that can be tricked by making spaces ex." pass2233word"
9 messages ยท Page 1 of 1 (latest)
@pale niche
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
from flask import Flask, render_template, request, jsonify
import random
import string
app = Flask(name)
def is_password_secure(password, personal_info):
# Check if password length is at least 8 characters
if len(password) < 8:
return False
# Check if password contains at least one uppercase letter
if not any(char.isupper() for char in password):
return False
# Check if password contains any personal information
for info in personal_info:
if info and info.lower() in password.lower():
return False
return True
def generate_secure_password():
# Generate a secure random password
characters = string.ascii_letters + string.digits + '!@#$%^&*()'
return ''.join(random.choice(characters) for _ in range(12))
@app.route('/')
def index():
return render_template('index.html')
@app.route('/check_password', methods=['POST'])
def check_password():
data = request.json
first_name = data.get('firstName')
last_name = data.get('lastName')
birth_date = data.get('birthDate')
location = data.get('location')
phone_number = data.get('phoneNumber')
password = data.get('password')
personal_info = [first_name, last_name, birth_date, location, phone_number]
if is_password_secure(password, personal_info):
with open('passwords.txt', 'a') as file:
file.write(password + '\n')
return jsonify({'message': '.'})
else:
secure_password = generate_secure_password()
return jsonify({'message': f': {secure_password}'})
if name == 'main':
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
!code or
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.