Changed some field names from address to email.

- Legacy-Id: 11385
This commit is contained in:
Henrik Levkowetz 2016-06-15 15:49:28 +00:00
parent c0ba793c69
commit 016f912ef7
9 changed files with 20 additions and 20 deletions

View file

@ -155,7 +155,7 @@ class IetfAuthTests(TestCase):
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
self.assertIn("Add a whitelist entry", unicontent(r)) self.assertIn("Add a whitelist entry", unicontent(r))
r = self.client.post(urlreverse(ietf.ietfauth.views.add_account_whitelist), {"address": email}) r = self.client.post(urlreverse(ietf.ietfauth.views.add_account_whitelist), {"email": email})
self.assertEqual(r.status_code, 200) self.assertEqual(r.status_code, 200)
self.assertIn("Whitelist entry creation successful", unicontent(r)) self.assertIn("Whitelist entry creation successful", unicontent(r))
@ -172,7 +172,7 @@ class IetfAuthTests(TestCase):
saved_delay = settings.LIST_ACCOUNT_DELAY saved_delay = settings.LIST_ACCOUNT_DELAY
settings.LIST_ACCOUNT_DELAY = 1 settings.LIST_ACCOUNT_DELAY = 1
email = "subscribed@example.com" email = "subscribed@example.com"
s = Subscribed(address=email) s = Subscribed(email=email)
s.save() s.save()
time.sleep(1.1) time.sleep(1.1)
self.register_and_verify(email) self.register_and_verify(email)

View file

@ -92,8 +92,8 @@ def create_account(request):
form = RegistrationForm(request.POST) form = RegistrationForm(request.POST)
if form.is_valid(): if form.is_valid():
to_email = form.cleaned_data['email'] # This will be lowercase if form.is_valid() to_email = form.cleaned_data['email'] # This will be lowercase if form.is_valid()
existing = Subscribed.objects.filter(address=to_email).first() existing = Subscribed.objects.filter(email=to_email).first()
ok_to_create = ( Whitelisted.objects.filter(address=to_email).exists() ok_to_create = ( Whitelisted.objects.filter(email=to_email).exists()
or existing and (existing.time + TimeDelta(seconds=settings.LIST_ACCOUNT_DELAY)) < DateTime.now() ) or existing and (existing.time + TimeDelta(seconds=settings.LIST_ACCOUNT_DELAY)) < DateTime.now() )
if ok_to_create: if ok_to_create:
auth = django.core.signing.dumps(to_email, salt="create_account") auth = django.core.signing.dumps(to_email, salt="create_account")
@ -377,8 +377,8 @@ def add_account_whitelist(request):
if request.method == 'POST': if request.method == 'POST':
form = WhitelistForm(request.POST) form = WhitelistForm(request.POST)
if form.is_valid(): if form.is_valid():
address = form.cleaned_data['address'] email = form.cleaned_data['email']
entry = Whitelisted(address=address, by=request.user.person) entry = Whitelisted(email=email, by=request.user.person)
entry.save() entry.save()
success = True success = True
else: else:

View file

@ -12,12 +12,12 @@ admin.site.register(List, ListAdmin)
class SubscribedAdmin(admin.ModelAdmin): class SubscribedAdmin(admin.ModelAdmin):
list_display = ('id', 'time', 'address') list_display = ('id', 'time', 'email')
raw_id_fields = ('lists',) raw_id_fields = ('lists',)
search_fields = ('address',) search_fields = ('email',)
admin.site.register(Subscribed, SubscribedAdmin) admin.site.register(Subscribed, SubscribedAdmin)
class WhitelistedAdmin(admin.ModelAdmin): class WhitelistedAdmin(admin.ModelAdmin):
list_display = ('id', 'time', 'address', 'by') list_display = ('id', 'time', 'email', 'by')
admin.site.register(Whitelisted, WhitelistedAdmin) admin.site.register(Whitelisted, WhitelistedAdmin)

View file

@ -53,9 +53,9 @@ class Command(BaseCommand):
list, created = List.objects.get_or_create(name=mlist.real_name, description=mlist.description, advertised=mlist.advertised) list, created = List.objects.get_or_create(name=mlist.real_name, description=mlist.description, advertised=mlist.advertised)
# The following calls return lowercased addresses # The following calls return lowercased addresses
members = mlist.getRegularMemberKeys() + mlist.getDigestMemberKeys() members = mlist.getRegularMemberKeys() + mlist.getDigestMemberKeys()
known = [ s.address for s in Subscribed.objects.filter(lists__name=name) ] known = [ s.email for s in Subscribed.objects.filter(lists__name=name) ]
for addr in members: for addr in members:
if not addr in known: if not addr in known:
self.note(" Adding subscribed: %s" % (addr)) self.note(" Adding subscribed: %s" % (addr))
new, created = Subscribed.objects.get_or_create(address=addr) new, created = Subscribed.objects.get_or_create(email=addr)
new.lists.add(list) new.lists.add(list)

View file

@ -8,7 +8,7 @@ import django.core.validators
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('person', '0014_auto_20160613_0751'), ('person', '0013_add_plain_name_aliases'),
('mailinglists', '0001_initial'), ('mailinglists', '0001_initial'),
] ]
@ -30,7 +30,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('time', models.DateTimeField(auto_now_add=True)), ('time', models.DateTimeField(auto_now_add=True)),
('address', models.CharField(max_length=64, validators=[django.core.validators.EmailValidator()])), ('email', models.CharField(max_length=64, validators=[django.core.validators.EmailValidator()])),
('lists', models.ManyToManyField(to='mailinglists.List')), ('lists', models.ManyToManyField(to='mailinglists.List')),
], ],
options={ options={
@ -42,7 +42,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('time', models.DateTimeField(auto_now_add=True)), ('time', models.DateTimeField(auto_now_add=True)),
('address', models.CharField(max_length=64, validators=[django.core.validators.EmailValidator()])), ('email', models.CharField(max_length=64, verbose_name=b'Email address', validators=[django.core.validators.EmailValidator()])),
('by', models.ForeignKey(to='person.Person')), ('by', models.ForeignKey(to='person.Person')),
], ],
options={ options={

View file

@ -22,7 +22,7 @@ class WhitelistedResource(ModelResource):
filtering = { filtering = {
"id": ALL, "id": ALL,
"time": ALL, "time": ALL,
"address": ALL, "email": ALL,
"by": ALL_WITH_RELATIONS, "by": ALL_WITH_RELATIONS,
} }
api.mailinglists.register(WhitelistedResource()) api.mailinglists.register(WhitelistedResource())
@ -51,7 +51,7 @@ class SubscribedResource(ModelResource):
filtering = { filtering = {
"id": ALL, "id": ALL,
"time": ALL, "time": ALL,
"address": ALL, "email": ALL,
"lists": ALL_WITH_RELATIONS, "lists": ALL_WITH_RELATIONS,
} }
api.mailinglists.register(SubscribedResource()) api.mailinglists.register(SubscribedResource())

View file

@ -46,8 +46,8 @@
Google for the person's name within the ietf site: "Jane Doe site:ietf.org". If Google for the person's name within the ietf site: "Jane Doe site:ietf.org". If
found, and the email address matches an address used in drafts or discussions, found, and the email address matches an address used in drafts or discussions,
things are fine, and it's OK to add the address to the whitelist using this form, things are fine, and it's OK to add the address to the whitelist using this form,
and ask the person to please try the <a href="{% url and ask the person to please try the
'ietf.ietfauth.views.create_account' %}">account creation form</a> again. <a href="{% url 'ietf.ietfauth.views.create_account' %}">account creation form</a> again.
</li> </li>
<li> <li>
@ -74,8 +74,8 @@
<p> <p>
If the answer to this question shows clue, then add the address to the whitelist If the answer to this question shows clue, then add the address to the whitelist
using this form, and ask the person to please try the <a href="{% url using this form, and ask the person to please try the
'ietf.ietfauth.views.create_account' %}"> account creation form</a> again. <a href="{% url 'ietf.ietfauth.views.create_account' %}"> account creation form</a> again.
</p> </p>
</li> </li>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB