diff options
| author | Fulgen301 <tokmajigeorge@gmail.com> | 2018-09-16 16:58:21 +0200 |
|---|---|---|
| committer | Fulgen301 <tokmajigeorge@gmail.com> | 2018-09-16 16:58:21 +0200 |
| commit | 027139279aa0e83c123ba26139d84505f1d4af90 (patch) | |
| tree | ff9ecd64cab21f2b034288a476870282fb944fa5 /routes/auth.py | |
| parent | 0184fbb68c8bf1d8d1a123929dfab0497d5236af (diff) | |
| download | parry-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.py | 10 |
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() + |
