X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/f589e41b46ab266706a7f82a5562f50805359b26..f32668123bbf48a0b73e90024bc09aa60e903ea0:/forum/views/decorators.py diff --git a/forum/views/decorators.py b/forum/views/decorators.py index 758b687..20eb45c 100644 --- a/forum/views/decorators.py +++ b/forum/views/decorators.py @@ -6,11 +6,22 @@ from django.core.urlresolvers import reverse from django.template import RequestContext from django.utils.translation import ungettext, ugettext as _ from forum.modules import ui, decorate +from datetime import datetime, date +from forum.settings import ONLINE_USERS import logging +def login_required(func, request, *args, **kwargs): + if not request.user.is_authenticated(): + return HttpResponseRedirect(reverse('auth_signin')) + else: + return func(request, *args, **kwargs) + def render(template=None, tab=None, tab_title='', weight=500, tabbed=True): def decorator(func): def decorated(context, request, *args, **kwargs): + if request.user.is_authenticated(): + ONLINE_USERS[request.user] = datetime.now() + if isinstance(context, HttpResponse): return context