fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f0eb06f
)
links to login/reset on register error
author
Jan Szejko
<janek37@gmail.com>
Mon, 13 Mar 2017 10:00:29 +0000
(11:00 +0100)
committer
Jan Szejko
<janek37@gmail.com>
Mon, 13 Mar 2017 10:00:29 +0000
(11:00 +0100)
redakcja/forms.py
patch
|
blob
|
history
diff --git
a/redakcja/forms.py
b/redakcja/forms.py
index
0d21bb3
..
0a771c7
100644
(file)
--- 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
# 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
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
@@
-18,7
+20,11
@@
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():
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. '
+ '<a href="%s">Log in</a> or <a href="%s">reset your password</a>.') % (
+ reverse('login'), 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
if len(email) > max_length:
raise forms.ValidationError(_('Username too long. Max length: %s') % max_length)
return email