Limit sender username
This commit is contained in:
parent
19c4cb71f6
commit
739295e865
1 changed files with 2 additions and 0 deletions
2
chat.py
2
chat.py
|
@ -105,6 +105,8 @@ def messages_post():
|
||||||
if "X-Username" in request.headers and len(request.headers["X-Username"]) > 0:
|
if "X-Username" in request.headers and len(request.headers["X-Username"]) > 0:
|
||||||
sender = request.headers["X-Username"]
|
sender = request.headers["X-Username"]
|
||||||
sendertype = "name"
|
sendertype = "name"
|
||||||
|
if len(sender) > 50:
|
||||||
|
return "Username too long"
|
||||||
elif "X-Real-IP" in request.headers:
|
elif "X-Real-IP" in request.headers:
|
||||||
sender = reverse_lookup(request.headers["X-Real-IP"])
|
sender = reverse_lookup(request.headers["X-Real-IP"])
|
||||||
sendertype = "ip"
|
sendertype = "ip"
|
||||||
|
|
Loading…
Reference in a new issue