From 0486b0801e1f5750f3e478607082552d5e7946fc Mon Sep 17 00:00:00 2001 From: Fulgen301 Date: Sun, 16 Sep 2018 17:48:13 +0200 Subject: auth: Use request_data(), fix wrong status code --- routes/auth.py | 7 +++---- 1 file 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() -- cgit v1.2.3-54-g00ecf