aboutsummaryrefslogtreecommitdiffstats
path: root/routes/auth.py
diff options
context:
space:
mode:
authorFulgen301 <tokmajigeorge@gmail.com>2018-10-16 18:57:01 +0200
committerFulgen301 <tokmajigeorge@gmail.com>2018-10-16 18:57:01 +0200
commit8213c244eaca9a65a51ccb8422b3adb45485ef43 (patch)
treed8f22d6e91aa869e8ab51b5d5bf6de5de2824881 /routes/auth.py
parent28afed69d3f5a04c86aa87ad18e15ec55bdc7a82 (diff)
downloadparry-8213c244eaca9a65a51ccb8422b3adb45485ef43.tar.gz
parry-8213c244eaca9a65a51ccb8422b3adb45485ef43.zip
Subclass HTTPReponse in order to ensure the presence of CORS headers
Diffstat (limited to 'routes/auth.py')
-rw-r--r--routes/auth.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/routes/auth.py b/routes/auth.py
index d6b6ffd..cdcacf1 100644
--- a/routes/auth.py
+++ b/routes/auth.py
@@ -21,16 +21,16 @@ def post_auth_new():
username = request_data()["username"]
password = request_data()["password"]
except KeyError as e:
- raise HTTPResponse("Username or password missing", 400)
+ raise ParryHTTPResponse("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=409)
+ raise ParryHTTPResponse("User already exists", status=409)
except db.orm.exc.NoResultFound:
session.add(User(name=username, hash=hash))
session.commit()
- return HTTPResponse(status=303, headers={"Location" : "/api/auth"})
+ return ParryHTTPResponse(status=303, headers={"Location" : "/api/auth"})
@get("/api/auth")
@jwt_auth_required