Commit 4bcfd3fe authored by Claude Paroz's avatar Claude Paroz

Don't show login form when the user is authenticated

Thanks Tom Tryfonidis for the initial patch.
parent bb8ce22c
Pipeline #47652 passed with stage
in 3 minutes and 39 seconds
......@@ -72,6 +72,12 @@ class PeopleTestCase(TestCase):
'You have not joined any translation team yet. '
'You can do it from <a href="/users/team_join/">your profile</a>.'
)
response = self.client.get(reverse('login'))
self.assertContains(
response,
'You are already logged in as jn.'
)
self.assertNotContains(response, 'id="login-form"')
def test_login_by_email(self):
self.pn = self._create_person()
......
......@@ -7,6 +7,9 @@
<div class="col-sm-8 col-md-6 col-centered">
<h1>{% trans "User Login" %}</h1>
{% if user.is_authenticated %}
<p>{% blocktrans with user.username as username %}You are already logged in as {{ username }}.{% endblocktrans %}</p>
{% else %}
<p>{% trans 'Log in with your username (or email) and password:' %}</p>
<form action="{% url 'login' %}" method="post" id="login-form" class="form">
{% csrf_token %}
......@@ -33,9 +36,6 @@
<hr>
<p class="text-center main_feature" style="margin-bottom: 30px;">Don't have an account?</p>
{% if user.is_authenticated %}
<p>{% blocktrans with user.username as username %}You are already logged in as {{ username }}.{% endblocktrans %}</p>
{% else %}
{% url 'register' as link %}
<a href="{{ link }}" class="btn btn-action btn-block">{% trans "Register" %}</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment