forked from TriLinder/CapitalPassword
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
48 lines (33 loc) · 1.64 KB
/
main.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from flask import Flask, render_template, request
import io
app = Flask(__name__)
with io.open("kerulets.txt", mode="r", encoding="utf-8") as f :
capitals = f.read().split("\n")
del capitals[-1] #i fucking hate this language
def listInStr(list, str) :
for x in list :
if x.lower() in str.lower() :
return True
return False
#-----------------------------------------------#
@app.route("/register")
def register() :
return render_template("register.html", error="")
@app.route("/register-handler", methods=["POST"])
def registerHandler() :
usr = request.form["username"]
pswd = request.form["password"]
if not len(usr) > 2 :
return render_template("register.html", error="neved 3 (karak)ter hossz..", usr=usr, pswd=pswd)
if not len(pswd) > 2 :
return render_template("register.html", error="szavad 3 (karak)ter hossz..", usr=usr, pswd=pswd)
if len(pswd) > 32 :
return render_template("register.html", error="szavad 365 (nap trianon végéig) (karak)ter hossz-nál több..", usr=usr, pswd=pswd)
if not listInStr(["1","2","3","4","5","6","7","8","9"], pswd) :
return render_template("register.html", error="kell egy number ami nem 0", usr=usr, pswd=pswd)
if not listInStr(["?","!","#","@"], pswd) :
return render_template("register.html", error="ezekből jelszó egy & több: ?!#@", usr=usr, pswd=pswd)
if not listInStr(capitals, pswd) :
return render_template("register.html", error="legyen egy kerület jelszóban", usr=usr, pswd=pswd)
return "<h3>istenáldmegamagyart bass boosted..</h3>"
app.run(debug=False, host="0.0.0.0", port=5000)