Take user to logged in page when already authenticated
This commit is contained in:
parent
c3b8f7b553
commit
f61023d01a
1 changed files with 9 additions and 0 deletions
|
@ -8,6 +8,7 @@ from django.core.validators import validate_email, ValidationError
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
||||||
from django.core.mail import EmailMessage
|
from django.core.mail import EmailMessage
|
||||||
|
from django.views.decorators.cache import cache_control
|
||||||
from .models import ResetToken
|
from .models import ResetToken
|
||||||
from .forms import LoginForm
|
from .forms import LoginForm
|
||||||
from .ungleich_ldap import LdapManager
|
from .ungleich_ldap import LdapManager
|
||||||
|
@ -44,6 +45,14 @@ class Index(FormView):
|
||||||
return render(self.request, 'useroptions.html', { 'user': user } )
|
return render(self.request, 'useroptions.html', { 'user': user } )
|
||||||
return render(self.request, 'loginfailed.html')
|
return render(self.request, 'loginfailed.html')
|
||||||
|
|
||||||
|
@cache_control(no_cache=True, must_revalidate=True, no_store=True)
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
if self.request.user.is_authenticated:
|
||||||
|
return render(self.request, 'useroptions.html',
|
||||||
|
{ 'user': self.request.user.username } )
|
||||||
|
return super(Index, self).get(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class Register(View):
|
class Register(View):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
return render(request, 'registeruser.html')
|
return render(request, 'registeruser.html')
|
||||||
|
|
Loading…
Reference in a new issue