diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2016-03-27 14:27:23 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2016-03-27 14:31:59 +0200 |
commit | 60c8386b63fe526f881120028dc46f1fd150bf72 (patch) | |
tree | bf37525c5848113e6959089cf5b57beb203e30c6 | |
parent | 0352e45513762cbcf7f8441a7073be27a4293bc8 (diff) |
Added the test_token API method.
This API method checks whether the provided token is valid or not.
-rwxr-xr-x | fbin.py | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -553,6 +553,14 @@ class Application(object): except: pass data['status'] = True + elif method == 'test_token': + try: + user = self.jab.get_user_by_token(form['token'].value, settings.jab_identifier, environ['REMOTE_ADDR']) + except jab.client.InvalidCredentialsError: + return error('Invalid token') + except: + return error('Error fetching user data') + data['status'] = True else: data['message'] = 'Unknown method "%s"' start_response('200 OK', [('Content-Type', 'application/json')]) |