Commit 383610b5 authored by Claude Paroz's avatar Claude Paroz

Warn when user did not join any translation team after login

People creating account on l10n.gnome.org don't always realize
they have to explicitely join a team. This message reminds
them to do it. Thanks to Aron Xu for the suggestion.
parent ecdb08ab
......@@ -26,6 +26,7 @@ from django.utils.translation import ugettext as _
from django.contrib.auth import login, authenticate, logout
from django.conf import settings
from people.models import Person
from teams.models import Role
from people.forms import RegistrationForm
......@@ -61,6 +62,11 @@ def site_login(request, msgs=[]):
login(request, user)
message = _("You have been successfully logged in.")
user.message_set.create(message=message)
if Role.objects.filter(person__username=user.username).count() < 1:
message = _("You have not joined any translation team yet. You can do it from <a href=\"%(url)s\">your profile</a>.") % {
'url': reverse('person-team-join-view'),
}
user.message_set.create(message=message)
if request.POST['referer']:
return HttpResponseRedirect(request.POST['referer'])
else:
......
......@@ -82,7 +82,7 @@
<div id="content">
{% if messages %}
{% for message in messages %}
<p class="errornote">{{ message }}</p>
<p class="errornote">{{ message|safe }}</p>
{% endfor %}
{% endif %}
......
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