Commit c5d587cc authored by Vangelis Koukis's avatar Vangelis Koukis
Browse files

Fix test token duration, minor bug in API

Modify db/fixtures/initial_data.json and settings.py.dist to
fix the duration of the test token.

Fix minor bug in api/util.py when no valid SynnefoUser
could be found or the provided X-Auth-Token was invalid.
parent 4d25d82b
......@@ -213,9 +213,9 @@ def api_method(http_method=None, atom_allowed=False):
@wraps(func)
def wrapper(request, *args, **kwargs):
try:
request.serialization = request_serialization(request, atom_allowed)
if not request.user:
raise Unauthorized('No user found.')
request.serialization = request_serialization(request, atom_allowed)
if http_method and request.method != http_method:
raise BadRequest('Method not allowed.')
......
......@@ -8,9 +8,9 @@
"uniq" :"test@synnefo.gr",
"credit": 10,
"auth_token": "46e427d657b20defe352804f0eb6f8a2",
"auth_token_created": "2011-02-06",
"auth_token_created": "2011-05-10",
"type": "STUDENT",
"created": "2011-02-06"
"created": "2011-05-10"
}
}
]
......@@ -184,6 +184,8 @@ APP_INSTALL_URL = "https://login.okeanos.grnet.gr/okeanos"
LOGIN_PATH = "/login"
#Number of hours during which a user token is active
AUTH_TOKEN_DURATION = 24
# Number of hours during which a user token is active
# ACHTUNG: The test token distributed in db/initial_data.json will cease to
# work after this many hours after 2011/05/10
AUTH_TOKEN_DURATION = 30 * 24
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment