-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
48 lines (33 loc) · 1.69 KB
/
Copy pathapp.py
File metadata and controls
48 lines (33 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
print("APP.PY STARTED")
from flask import Flask, render_template, request
from analyzer import analyze_password
from generator import generate_password
from database import *
app = Flask(__name__, static_folder="assets")
create_table()
with open("common_passwords.txt", "r") as f :
common_passwords = set(line.strip () for line in f)
@app.route("/", methods=["GET", "POST"])
def home():
if request.method == "POST":
password = request.form["password"]
reused = password_exists(password)
score, strength, result, suggestions = analyze_password(
password,
common_passwords
)
if not reused:
save_password(password)
return render_template(
"index.html",
password=password,
result=result,
score=score,
strength=strength,
suggestions=suggestions,
reused=reused,
generated=generate_password()
)
return render_template("index.html")
if __name__ == "__main__":
app.run(debug=True)