search fixes
[wolnelektury.git] / wolnelektury / views.py
index cb1d2af..37df778 100755 (executable)
@@ -36,7 +36,9 @@ class LoginFormView(AjaxableFormView):
 
     def __call__(self, request):
         if request.user.is_authenticated():
-            return HttpResponseRedirect('/')
+            return self.redirect_or_refresh(request, '/',
+                message=_('Already logged in as user %(user)s', ) %
+                            {'user': request.user.username})
         return super(LoginFormView, self).__call__(request)
 
     def success(self, form, request):
@@ -45,6 +47,7 @@ class LoginFormView(AjaxableFormView):
 
 class RegisterFormView(AjaxableFormView):
     form_class = UserCreationForm
+    template = "auth/register.html"
     placeholdize = True
     title = _('Register')
     submit = _('Register')
@@ -53,7 +56,9 @@ class RegisterFormView(AjaxableFormView):
 
     def __call__(self, request):
         if request.user.is_authenticated():
-            return HttpResponseRedirect('/')
+            return self.redirect_or_refresh(request, '/',
+                message=_('Already logged in as user %(user)s', ) %
+                            {'user': request.user.username})
         return super(RegisterFormView, self).__call__(request)
 
     def success(self, form, request):