don't leak information about other users aliases and mailboxes
This commit is contained in:
parent
252982d038
commit
5fce1fb288
1 changed files with 16 additions and 0 deletions
|
@ -109,6 +109,10 @@ def edit_mailbox(request, mailbox_id):
|
|||
if form.is_valid() and form.cleaned_data['domain'] in domains:
|
||||
form.save()
|
||||
return HttpResponseRedirect('/mailboxes/')
|
||||
else:
|
||||
if not form.cleaned_data['domain'] in domains:
|
||||
form.errors.clear()
|
||||
form.add_error(None, "You don't own this domain")
|
||||
|
||||
except IntegrityError as e:
|
||||
form.add_error(None, e)
|
||||
|
@ -129,6 +133,10 @@ def new_mailbox(request):
|
|||
if form.is_valid() and form.cleaned_data['domain'] in domains:
|
||||
form.save()
|
||||
return HttpResponseRedirect('/mailboxes/')
|
||||
else:
|
||||
if not form.cleaned_data['domain'] in domains:
|
||||
form.errors.clear()
|
||||
form.add_error(None, "You don't own this domain")
|
||||
|
||||
except IntegrityError as e:
|
||||
form.add_error(None, e)
|
||||
|
@ -153,6 +161,10 @@ def edit_alias(request, alias_id):
|
|||
if form.is_valid() and form.cleaned_data['source_domain'] in domains:
|
||||
form.save()
|
||||
return HttpResponseRedirect('/aliases/')
|
||||
else:
|
||||
if not form.cleaned_data['source_domain'] in domains:
|
||||
form.errors.clear()
|
||||
form.add_error(None, "You don't own this domain")
|
||||
|
||||
except IntegrityError as e:
|
||||
form.add_error(None, e)
|
||||
|
@ -173,6 +185,10 @@ def new_alias(request):
|
|||
if form.is_valid() and form.cleaned_data['source_domain'] in domains:
|
||||
form.save()
|
||||
return HttpResponseRedirect('/aliases/')
|
||||
else:
|
||||
if not form.cleaned_data['source_domain'] in domains:
|
||||
form.errors.clear()
|
||||
form.add_error(None, "You don't own this domain")
|
||||
|
||||
except IntegrityError as e:
|
||||
form.add_error(None, e)
|
||||
|
|
Loading…
Reference in a new issue