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
@@ -71,6 +71,7 @@ def remember_password(request): @@ -71,6 +71,7 @@ def remember_password(request):
71 @log_decorator('Acessar', 'Sistema') 71 @log_decorator('Acessar', 'Sistema')
72 def login(request): 72 def login(request):
73 context = {} 73 context = {}
  74 +
74 if request.POST: 75 if request.POST:
75 username = request.POST['username'] 76 username = request.POST['username']
76 password = request.POST['password'] 77 password = request.POST['password']
@@ -80,6 +81,9 @@ def login(request): @@ -80,6 +81,9 @@ def login(request):
80 return redirect(reverse("app:index")) 81 return redirect(reverse("app:index"))
81 else: 82 else:
82 context["message"] = _("E-mail or password are incorrect!") 83 context["message"] = _("E-mail or password are incorrect!")
  84 + elif request.user.is_authenticated:
  85 + return redirect(reverse('app:index'))
  86 +
83 return render(request,"index.html",context) 87 return render(request,"index.html",context)
84 88
85 89