0.8.30 check password
This commit is contained in:
@@ -30,21 +30,15 @@ class RegistrationForm(forms.Form):
|
|||||||
agreement = forms.BooleanField(initial=False, required=True)
|
agreement = forms.BooleanField(initial=False, required=True)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
pass
|
cleaned_data = super().clean()
|
||||||
# cleaned_data = super().clean()
|
if cleaned_data['confirm_password'] != cleaned_data['password']:
|
||||||
# for item in self.changed_data:
|
self.add_error("password", _('Пароль и подтверждение пароля не совпадают'))
|
||||||
# if item in self.data:
|
self.add_error("confirm_password", _('Пароль и подтверждение пароля не совпадают'))
|
||||||
#
|
|
||||||
#
|
users = User.objects.filter(email=cleaned_data['email'])
|
||||||
# cc_myself = cleaned_data.get("cc_myself")
|
if users:
|
||||||
# subject = cleaned_data.get("subject")
|
self.add_error('email', _("Пользователь с указанным email уже существует"))
|
||||||
#
|
|
||||||
# if cc_myself and subject:
|
|
||||||
# # Only do something if both fields are valid so far.
|
|
||||||
# if "help" not in subject:
|
|
||||||
# raise ValidationError(
|
|
||||||
# "Did not send for 'help' in the subject despite " "CC'ing yourself."
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -393,12 +393,12 @@ def registration_ajax(request):
|
|||||||
html = render_to_string('forms/f_registration.html', Dict, request=request)
|
html = render_to_string('forms/f_registration.html', Dict, request=request)
|
||||||
return JsonResponse({'html': html}, status=400)
|
return JsonResponse({'html': html}, status=400)
|
||||||
|
|
||||||
users = User.objects.filter(email=form.data['email'])
|
# users = User.objects.filter(email=form.data['email'])
|
||||||
if users:
|
# if users:
|
||||||
form.errors['email'] = _("Пользователь с указанным email уже существует")
|
# form.errors['email'] = _("Пользователь с указанным email уже существует")
|
||||||
Dict = {'form': form}
|
# Dict = {'form': form}
|
||||||
html = render_to_string('forms/f_registration.html', Dict, request=request)
|
# html = render_to_string('forms/f_registration.html', Dict, request=request)
|
||||||
return JsonResponse({'html': html}, status=400)
|
# return JsonResponse({'html': html}, status=400)
|
||||||
|
|
||||||
user = User.objects.create_user(username=form.data['email'], email=form.data['email'], password=form.data['password'])
|
user = User.objects.create_user(username=form.data['email'], email=form.data['email'], password=form.data['password'])
|
||||||
# user = auth.authenticate(username=new_user_Dict['name'], password=new_user_Dict['pass'])
|
# user = auth.authenticate(username=new_user_Dict['name'], password=new_user_Dict['pass'])
|
||||||
|
|||||||
Reference in New Issue
Block a user