Commit 3652ee1c2c5aa11ccf9434dd2ef16d29cdab5fc0

Authored by Zambom
1 parent aada597f

Fix 'seeing login page after authenticate' issue

Showing 1 changed file with 4 additions and 0 deletions   Show diff stats
core/views.py
... ... @@ -71,6 +71,7 @@ def remember_password(request):
71 71 @log_decorator('Acessar', 'Sistema')
72 72 def login(request):
73 73 context = {}
  74 +
74 75 if request.POST:
75 76 username = request.POST['username']
76 77 password = request.POST['password']
... ... @@ -80,6 +81,9 @@ def login(request):
80 81 return redirect(reverse("app:index"))
81 82 else:
82 83 context["message"] = _("E-mail or password are incorrect!")
  84 + elif request.user.is_authenticated:
  85 + return redirect(reverse('app:index'))
  86 +
83 87 return render(request,"index.html",context)
84 88  
85 89  
... ...