-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
47 lines (35 loc) · 983 Bytes
/
server.py
File metadata and controls
47 lines (35 loc) · 983 Bytes
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
from flask import Flask, render_template, request
import checkmypass
import create_password
app = Flask(__name__)
@app.route("/")
def my_home():
return render_template("index.html")
@app.route("/check.html", methods=["GET", "POST"])
def checker_page():
result = None
if request.method == "POST":
# HTMLから受け取る
password = request.form["password"]
# checker.py の main() 実行
result = checkmypass.main(password)
# HTMLへ返す
return render_template(
"check.html",
result=result
)
# Password Create
@app.route("/create.html", methods=["GET", "POST"])
def create_page():
password = None
if request.method == "POST":
types = request.form.getlist("types")
length = int(request.form["length"])
password = create_password.main(
types,
length
)
return render_template(
"create.html",
password=password
)