Commit 4009ff6d authored by Mathieu Rodic's avatar Mathieu Rodic

[FEATURE] implemented a decorator for required authentication

parent 33f79fca
......@@ -3,4 +3,14 @@ from django.template import Context, RequestContext
from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseForbidden
from django.shortcuts import render_to_response,redirect
from django.utils.http import urlencode
from gargantext import settings
def requires_auth(func):
def _requires_auth(request, *args, **kwargs):
if not request.user.is_authenticated():
return redirect('/auth/login/?next=%s' % request.path)
return func(request, *args, **kwargs)
return _requires_auth
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