mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Fix some email checks being bypassed for legacy users
This commit is contained in:
parent
1755f6e624
commit
6235909a9a
1 changed files with 4 additions and 10 deletions
|
@ -564,11 +564,8 @@ class AdherentEditForm(AdherentForm):
|
||||||
original_email = self.user.email
|
original_email = self.user.email
|
||||||
new_email = self.cleaned_data.get("email")
|
new_email = self.cleaned_data.get("email")
|
||||||
|
|
||||||
# Allow empty emails if the user had an empty email before
|
# Allow empty emails only if the user had an empty email before
|
||||||
if not original_email:
|
if original_email and not new_email:
|
||||||
return new_email
|
|
||||||
|
|
||||||
if not new_email:
|
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
_("Email field cannot be empty.")
|
_("Email field cannot be empty.")
|
||||||
)
|
)
|
||||||
|
@ -880,11 +877,8 @@ class EmailSettingsForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
original_email = self.user.email
|
original_email = self.user.email
|
||||||
new_email = self.cleaned_data.get("email")
|
new_email = self.cleaned_data.get("email")
|
||||||
|
|
||||||
# Allow empty emails if the user had an empty email before
|
# Allow empty emails only if the user had an empty email before
|
||||||
if not original_email:
|
if original_email and not new_email:
|
||||||
return new_email
|
|
||||||
|
|
||||||
if not new_email:
|
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
_("Email field cannot be empty.")
|
_("Email field cannot be empty.")
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue