mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-15 20:48:02 +00:00
Differentiate if mail has been added by yourself or someone else (in the error message)
This commit is contained in:
@@ -62,12 +62,14 @@ class AddEmailForm(forms.Form):
|
|||||||
_('Address already added, currently unconfirmed'))
|
_('Address already added, currently unconfirmed'))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check whether or not the email is already confirmed by someone
|
# Check whether or not the email is already confirmed (by someone)
|
||||||
if ConfirmedEmail.objects.filter(
|
check_mail = ConfirmedEmail.objects.filter(
|
||||||
email=self.cleaned_data['email']).exists():
|
email=self.cleaned_data['email'])
|
||||||
self.add_error(
|
if check_mail.exists():
|
||||||
'email',
|
msg = _('Address already confirmed (by someone else)')
|
||||||
_('Address already confirmed (by someone else)'))
|
if check_mail.first().user == request.user:
|
||||||
|
msg = _('Address already confirmed (by you)')
|
||||||
|
self.add_error('email', msg)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
unconfirmed = UnconfirmedEmail()
|
unconfirmed = UnconfirmedEmail()
|
||||||
|
|||||||
Reference in New Issue
Block a user