mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 22:22:26 +00:00
Send confirmation email if necessary after editing EmailSettingsForm
This commit is contained in:
parent
5feef8ae17
commit
2532f8a142
2 changed files with 9 additions and 0 deletions
|
@ -857,7 +857,10 @@ class EmailSettingsForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
|||
def __init__(self, *args, **kwargs):
|
||||
prefix = kwargs.pop("prefix", self.Meta.model.__name__)
|
||||
super(EmailSettingsForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||
|
||||
self.should_send_confirmation_email = False
|
||||
self.fields["email"].label = _("Main email address")
|
||||
|
||||
if "local_email_redirect" in self.fields:
|
||||
self.fields["local_email_redirect"].label = _("Redirect local emails")
|
||||
if "local_email_enabled" in self.fields:
|
||||
|
|
|
@ -546,6 +546,12 @@ def edit_email_settings(request, user_instance, **_kwargs):
|
|||
if email_settings.changed_data:
|
||||
email_settings.save()
|
||||
messages.success(request, _("The email settings were edited."))
|
||||
|
||||
# Send confirmation email if necessary
|
||||
if email_settings.should_send_confirmation_email is True:
|
||||
user_instance.confirm_email_address_mail(request)
|
||||
messages.success(request, _("An email to confirm your address was sent."))
|
||||
|
||||
return redirect(
|
||||
reverse("users:profil", kwargs={"userid": str(user_instance.id)})
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue