mirror of
https://github.com/pretix/pretix.git
synced 2026-08-09 10:37:50 +00:00
Add "old email address" field
This commit is contained in:
@@ -190,6 +190,7 @@ class UserEmailChangeForm(forms.Form):
|
||||
'duplicate_identifier': _("There already is an account associated with this email address. "
|
||||
"Please choose a different one."),
|
||||
}
|
||||
old_email = forms.EmailField(label=_('Old email address'), disabled=True)
|
||||
new_email = forms.EmailField(label=_('New email address'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<p class="text-muted">
|
||||
{% trans "This changes the email address used to login to your account, as well as where we send email notifications." %}
|
||||
</p>
|
||||
{% bootstrap_field form.old_email %}
|
||||
{% bootstrap_field form.new_email %}
|
||||
<p>
|
||||
{% trans "We will send a confirmation code to your new email address, which you need to enter in the next step to confirm the email address is correct." %}
|
||||
|
||||
@@ -864,6 +864,11 @@ class UserEmailChangeView(RecentAuthenticationRequiredMixin, FormView):
|
||||
"user": self.request.user,
|
||||
}
|
||||
|
||||
def get_initial(self):
|
||||
return {
|
||||
"old_email": self.request.user.email
|
||||
}
|
||||
|
||||
def form_valid(self, form):
|
||||
self.request.user.send_confirmation_code('email_change', form.cleaned_data['new_email'])
|
||||
return redirect(reverse('control:user.settings.email.confirm', kwargs={}))
|
||||
|
||||
Reference in New Issue
Block a user