Commit 0b481654f07e67efc5b979d9e78741a278484f46
1 parent
9ea23b85
Exists in
master
and in
33 other branches
Updated form msg and used reverse link
Showing
1 changed file
with
6 additions
and
3 deletions
Show diff stats
colab/accounts/forms.py
@@ -3,10 +3,12 @@ | @@ -3,10 +3,12 @@ | ||
3 | from collections import OrderedDict | 3 | from collections import OrderedDict |
4 | 4 | ||
5 | from django import forms | 5 | from django import forms |
6 | +from django.conf import settings | ||
6 | from django.contrib.auth import authenticate, get_user_model | 7 | from django.contrib.auth import authenticate, get_user_model |
7 | from django.contrib.auth.forms import ReadOnlyPasswordHashField | 8 | from django.contrib.auth.forms import ReadOnlyPasswordHashField |
8 | from django.contrib.auth.tokens import default_token_generator | 9 | from django.contrib.auth.tokens import default_token_generator |
9 | from django.contrib.sites.shortcuts import get_current_site | 10 | from django.contrib.sites.shortcuts import get_current_site |
11 | +from django.core.urlresolvers import reverse | ||
10 | from django.template import loader | 12 | from django.template import loader |
11 | from django.utils.encoding import force_bytes | 13 | from django.utils.encoding import force_bytes |
12 | from django.utils.http import urlsafe_base64_encode | 14 | from django.utils.http import urlsafe_base64_encode |
@@ -16,7 +18,6 @@ from django.utils.safestring import mark_safe | @@ -16,7 +18,6 @@ from django.utils.safestring import mark_safe | ||
16 | 18 | ||
17 | from conversejs.models import XMPPAccount | 19 | from conversejs.models import XMPPAccount |
18 | 20 | ||
19 | -from django.conf import settings | ||
20 | 21 | ||
21 | from .utils.validators import validate_social_account | 22 | from .utils.validators import validate_social_account |
22 | from .utils import mailman | 23 | from .utils import mailman |
@@ -67,8 +68,10 @@ class UserForm(forms.ModelForm): | @@ -67,8 +68,10 @@ class UserForm(forms.ModelForm): | ||
67 | user_qs = User.objects.filter(email=email).exclude(username=username) | 68 | user_qs = User.objects.filter(email=email).exclude(username=username) |
68 | 69 | ||
69 | if email and user_qs.exists(): | 70 | if email and user_qs.exists(): |
70 | - msg = mark_safe("Try login in: <a href='login'>sign in<a/>") | ||
71 | - raise forms.ValidationError(msg) | 71 | + url = reverse('login') |
72 | + msg = ("Email already used. Is it you?" | ||
73 | + " Please <a href='{}'>login<a/>").format(url) | ||
74 | + raise forms.ValidationError(mark_safe(msg)) | ||
72 | 75 | ||
73 | return email | 76 | return email |
74 | 77 |