-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
33 lines (27 loc) · 941 Bytes
/
app.py
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
import random
from flask import Flask, render_template,request
from dotenv import load_dotenv
load_dotenv()
def create_app():
app = Flask(__name__)
@app.route("/",methods=["GET","POST"])
def home():
characters = list('abcdefghijklmnopqrstuvwxyz')
if request.form.get("uppercase"):
characters.extend(list('ABCDEFGHIJKLMNOPQRSTUVWXYZ'))
if request.form.get("special"):
characters.extend(list('!@#$%&*'))
if request.form.get("numbers"):
characters.extend(list('1234567890'))
length = int(request.form.get("length") or 12)
password = ''
for x in range(length):
password += random.choice(characters)
return render_template("home.html",password=password)
@app.route("/about/")
def about():
return render_template("about.html")
return app
app = create_app()
if __name__ == '__main__':
app.run()