Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions ietf/ietfauth/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,29 +226,8 @@ def register_and_verify(self, email):

self.assertTrue(self.username_in_htpasswd_file(email))

def test_create_allowlisted_account(self):
email = "new-account@example.com"

# add allowlist entry
r = self.client.post(urlreverse(ietf.ietfauth.views.login), {"username":"secretary", "password":"secretary+password"})
self.assertEqual(r.status_code, 302)
self.assertEqual(urlsplit(r["Location"])[2], urlreverse(ietf.ietfauth.views.profile))

r = self.client.get(urlreverse(ietf.ietfauth.views.add_account_allowlist))
self.assertEqual(r.status_code, 200)
self.assertContains(r, "Add an allowlist entry")

r = self.client.post(urlreverse(ietf.ietfauth.views.add_account_allowlist), {"email": email})
self.assertEqual(r.status_code, 200)
self.assertContains(r, "Allowlist entry creation successful")

# log out
r = self.client.post(urlreverse('django.contrib.auth.views.logout'), {})
self.assertEqual(r.status_code, 200)

# register and verify allowlisted email
self.register_and_verify(email)


# This also tests new account creation.
def test_create_existing_account(self):
# create account once
email = "new-account@example.com"
Expand Down
1 change: 0 additions & 1 deletion ietf/ietfauth/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@
url(r'^review/$', views.review_overview),
url(r'^testemail/$', views.test_email),
url(r'^username/$', views.change_username),
url(r'^allowlist/add/?$', views.add_account_allowlist),
]
21 changes: 2 additions & 19 deletions ietf/ietfauth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@

from ietf.group.models import Role, Group
from ietf.ietfauth.forms import ( RegistrationForm, PasswordForm, ResetPasswordForm, TestEmailForm,
AllowlistForm, ChangePasswordForm, get_person_form, RoleEmailForm,
ChangePasswordForm, get_person_form, RoleEmailForm,
NewEmailForm, ChangeUsernameForm, PersonPasswordForm)
from ietf.ietfauth.htpasswd import update_htpasswd_file
from ietf.ietfauth.utils import role_required, has_role
from ietf.mailinglists.models import Allowlisted
from ietf.ietfauth.utils import has_role
from ietf.name.models import ExtResourceName
from ietf.nomcom.models import NomCom
from ietf.person.models import Person, Email, Alias, PersonalApiKey, PERSON_API_KEY_VALUES
Expand Down Expand Up @@ -600,23 +599,7 @@ def test_email(request):

return r

@role_required('Secretariat')
def add_account_allowlist(request):
success = False
if request.method == 'POST':
form = AllowlistForm(request.POST)
if form.is_valid():
email = form.cleaned_data['email']
entry = Allowlisted(email=email, by=request.user.person)
entry.save()
success = True
else:
form = AllowlistForm()

return render(request, 'ietfauth/allowlist_form.html', {
'form': form,
'success': success,
})

class AddReviewWishForm(forms.Form):
doc = SearchableDocumentField(label="Document", doc_type="draft")
Expand Down
2 changes: 2 additions & 0 deletions ietf/mailinglists/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def __str__(self):
def info_url(self):
return settings.MAILING_LIST_INFO_URL % {'list_addr': self.name }

# Allowlisted is unused, but is not being dropped until its human-curated content
# is archived outside this database.
class Allowlisted(models.Model):
time = models.DateTimeField(auto_now_add=True)
email = models.CharField("Email address", max_length=64, validators=[validate_email])
Expand Down
6 changes: 0 additions & 6 deletions ietf/templates/base/menu_user.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,6 @@
Sync discrepancies
</a>
</li>
<li>
<a class="dropdown-item {% if flavor != 'top' %} text-wrap{% endif %}"
href="{% url 'ietf.ietfauth.views.add_account_allowlist' %}">
Account allowlist
</a>
</li>
{% endif %}
{% if user|has_role:"IANA" %}
{% if flavor == "top" %}
Expand Down
78 changes: 0 additions & 78 deletions ietf/templates/ietfauth/allowlist_form.html

This file was deleted.