mirror of https://gitlab.crans.org/bde/nk20
🐛 A new user can't take an existing alias as username
This commit is contained in:
parent
66defee3ea
commit
fbf3a0bcf6
|
@ -139,7 +139,7 @@ class Profile(models.Model):
|
||||||
'token': email_validation_token.make_token(self.user),
|
'token': email_validation_token.make_token(self.user),
|
||||||
'uid': urlsafe_base64_encode(force_bytes(self.user.pk)),
|
'uid': urlsafe_base64_encode(force_bytes(self.user.pk)),
|
||||||
})
|
})
|
||||||
html = loader.render_to_string('registration/mails/email_validation_email.txt',
|
html = loader.render_to_string('registration/mails/email_validation_email.html',
|
||||||
{
|
{
|
||||||
'user': self.user,
|
'user': self.user,
|
||||||
'domain': os.getenv("NOTE_URL", "note.example.com"),
|
'domain': os.getenv("NOTE_URL", "note.example.com"),
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django import forms
|
||||||
from django.contrib.auth.forms import UserCreationForm
|
from django.contrib.auth.forms import UserCreationForm
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from note.models import NoteSpecial
|
from note.models import NoteSpecial, Alias
|
||||||
from note_kfet.inputs import AmountInput
|
from note_kfet.inputs import AmountInput
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,6 +22,12 @@ class SignUpForm(UserCreationForm):
|
||||||
self.fields['email'].required = True
|
self.fields['email'].required = True
|
||||||
self.fields['email'].help_text = _("This address must be valid.")
|
self.fields['email'].help_text = _("This address must be valid.")
|
||||||
|
|
||||||
|
def clean_username(self):
|
||||||
|
value = self.cleaned_data["username"]
|
||||||
|
if Alias.objects.filter(normalized_name=Alias.normalize(value)).exists():
|
||||||
|
self.add_error("username", _("An alias with a similar name already exists."))
|
||||||
|
return value
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = ('first_name', 'last_name', 'username', 'email', )
|
fields = ('first_name', 'last_name', 'username', 'email', )
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,13 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Account Activation</h2>
|
<h2>{% trans "Account activation" %}</h2>
|
||||||
|
|
||||||
An email has been sent. Please click on the link to activate your account.
|
<p>
|
||||||
|
{% trans "An email has been sent. Please click on the link to activate your account." %}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{% trans "You must also go to the Kfet to pay your membership. The WEI registration includes the BDE membership." %}
|
||||||
|
</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -27,7 +27,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% trans "After that, you'll have to wait that someone validates your account before you can log in. You will need to pay your membership in the Kfet." %}
|
{% trans "After that, you'll have to wait that someone validates your account before you can log in. You will need to pay your membership in the Kfet. Note that the WEI registration includes the Kfet membership." %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -8,7 +8,7 @@ https://{{ domain }}{% url 'registration:email_validation' uidb64=uid token=toke
|
||||||
|
|
||||||
{% trans "This link is only valid for a couple of days, after that you will need to contact us to validate your email." %}
|
{% trans "This link is only valid for a couple of days, after that you will need to contact us to validate your email." %}
|
||||||
|
|
||||||
{% trans "After that, you'll have to wait that someone validates your account before you can log in. You will need to pay your membership in the Kfet." %}
|
{% trans "After that, you'll have to wait that someone validates your account before you can log in. You will need to pay your membership in the Kfet. Note that the WEI registration includes the Kfet membership." %}
|
||||||
|
|
||||||
{% trans "Thanks" %},
|
{% trans "Thanks" %},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue