summaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorFulgen301 <tokmajigeorge@gmail.com>2018-09-16 17:48:13 +0200
committerFulgen301 <tokmajigeorge@gmail.com>2018-09-16 17:48:13 +0200
commit0486b0801e1f5750f3e478607082552d5e7946fc (patch)
tree5f4dd0e6e741fd357c703ff0c3ea939d0ed14e58 /routes
parent027139279aa0e83c123ba26139d84505f1d4af90 (diff)
downloadparry-0486b0801e1f5750f3e478607082552d5e7946fc.tar.gz
parry-0486b0801e1f5750f3e478607082552d5e7946fc.zip
auth: Use request_data(), fix wrong status code
Diffstat (limited to 'routes')
-rw-r--r--routes/auth.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/routes/auth.py b/routes/auth.py
index 934abc7..6c2e976 100644
--- a/routes/auth.py
+++ b/routes/auth.py
@@ -18,15 +18,14 @@ from ..helpers import *
def post_auth_new():
session = DBSession()
try:
- username = request.forms.username
- password = request.forms.password
+ username = request_data()["username"]
+ password = request_data()["password"]
except KeyError as e:
raise HTTPResponse("Username or password missing", 400)
hash = calculateUserHash(username, password).hexdigest()
try:
- session.query(User).filter(User.name == username or User.hash == hash).one()
- raise HTTPResponse("User already exists", status=410)
+ raise HTTPResponse("User already exists", status=409)
except db.orm.exc.NoResultFound:
session.add(User(name=username, hash=hash))
session.commit()