faking identities fixed
This commit is contained in:
parent
c5a87aebbd
commit
f951533a18
12
src/app.py
12
src/app.py
|
@ -70,11 +70,18 @@ def host():
|
||||||
def play(hash):
|
def play(hash):
|
||||||
if hash in games.keys():
|
if hash in games.keys():
|
||||||
if dohash(request.cookies.get('_gid')) == hash:
|
if dohash(request.cookies.get('_gid')) == hash:
|
||||||
return render_template('gamehost.html', version=str(version), gamecode=hash)
|
return render_template('gamehost.html', title="Host", version=str(version), gamecode=hash)
|
||||||
else:
|
else:
|
||||||
if "name" in request.cookies:
|
if "name" in request.cookies:
|
||||||
name = request.cookies.get("name")
|
name = request.cookies.get("name")
|
||||||
return render_template('play.html', version=str(version), gamecode=hash, username=name)
|
wlist = whitelist()
|
||||||
|
if name in games[hash]["players"].keys():
|
||||||
|
return render_template('nametaken.html', title='Join Game', version=str(version))
|
||||||
|
elif (not all([a in wlist for a in name])) or (len(name) > 12):
|
||||||
|
return render_template('badname.html', title='Join Game', version=str(version))
|
||||||
|
else:
|
||||||
|
games[hash]["players"][name] = 0
|
||||||
|
return render_template('play.html', version=str(version), title="Play", gamecode=hash, username=name)
|
||||||
else:
|
else:
|
||||||
return render_template('please.html', version=str(version))
|
return render_template('please.html', version=str(version))
|
||||||
else:
|
else:
|
||||||
|
@ -98,7 +105,6 @@ def join():
|
||||||
if hash in games.keys():
|
if hash in games.keys():
|
||||||
if form.name.data in games[hash]["players"].keys():
|
if form.name.data in games[hash]["players"].keys():
|
||||||
return render_template('nametaken.html', title='Join Game', version=str(version))
|
return render_template('nametaken.html', title='Join Game', version=str(version))
|
||||||
games[hash]["players"][form.name.data] = 0
|
|
||||||
resp = redirect(url_for("play", hash=hash))
|
resp = redirect(url_for("play", hash=hash))
|
||||||
resp.set_cookie("_gid", "")
|
resp.set_cookie("_gid", "")
|
||||||
resp.set_cookie("name", form.name.data)
|
resp.set_cookie("name", form.name.data)
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
<a href="{{ url_for('join') }}">Back</a>
|
<a href="{{ url_for('join') }}">Back</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<h1> Please join using the Join page. </h1>
|
<h1> Name not found. </h1>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
Reference in New Issue
Block a user