X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/ca89e871c8be7f850a1bea24a4ba59993372b7ed..f0114e5a98422c573e9389688cfa51a257c00f0d:/redakcja/forms.py
diff --git a/redakcja/forms.py b/redakcja/forms.py
index 0d21bb3a..12fb3a88 100644
--- a/redakcja/forms.py
+++ b/redakcja/forms.py
@@ -4,6 +4,8 @@
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django import forms
+from django.core.urlresolvers import reverse
+from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
@@ -18,7 +20,13 @@ class RegistrationForm(forms.Form):
max_length = User._meta.get_field('username').max_length
email = self.cleaned_data['email']
if User.objects.filter(username=email).exists():
- raise forms.ValidationError(_('User with this email address already exists.'))
+ msg = _(
+ 'User with this email address already exists. '
+ 'Log in or reset your password.') % {
+ 'login_url': reverse('login'),
+ 'reset_url': reverse('password_reset'),
+ }
+ raise forms.ValidationError(mark_safe(msg))
if len(email) > max_length:
raise forms.ValidationError(_('Username too long. Max length: %s') % max_length)
return email