summaryrefslogtreecommitdiffstats
path: root/routes/auth.py
diff options
context:
space:
mode:
authorFulgen301 <tokmajigeorge@gmail.com>2018-09-16 16:58:21 +0200
committerFulgen301 <tokmajigeorge@gmail.com>2018-09-16 16:58:21 +0200
commit027139279aa0e83c123ba26139d84505f1d4af90 (patch)
treeff9ecd64cab21f2b034288a476870282fb944fa5 /routes/auth.py
parent0184fbb68c8bf1d8d1a123929dfab0497d5236af (diff)
downloadparry-027139279aa0e83c123ba26139d84505f1d4af90.tar.gz
parry-027139279aa0e83c123ba26139d84505f1d4af90.zip
Use sqlalchemy as backend, implement JWT authentication, add uploading, commenting and voting
Diffstat (limited to 'routes/auth.py')
-rw-r--r--routes/auth.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/routes/auth.py b/routes/auth.py
index a34aaa5..934abc7 100644
--- a/routes/auth.py
+++ b/routes/auth.py
@@ -14,7 +14,7 @@
from ..helpers import *
-@route("/api/auth", method="POST")
+@post("/api/auth/register")
def post_auth_new():
session = DBSession()
try:
@@ -30,4 +30,10 @@ def post_auth_new():
except db.orm.exc.NoResultFound:
session.add(User(name=username, hash=hash))
session.commit()
- return HTTPResponse(status=201)
+ return HTTPResponse(status=303, headers={"Location" : "/api/auth"})
+
+@get("/api/auth")
+@jwt_auth_required
+def get_auth():
+ return request.get_user()
+