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
6 changes: 0 additions & 6 deletions ietf/help/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,3 @@ def test_state_index(self):
for name in names:
if not '-' in name:
self.assertIn(name, content)


def test_personal_information_help(self):
r = self.client.get('/help/personal-information')
self.assertContains(r, 'personal information')
self.assertContains(r, 'GDPR')
5 changes: 1 addition & 4 deletions ietf/help/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Copyright The IETF Trust 2013-2018, All Rights Reserved

from django.views.generic import TemplateView
# Copyright The IETF Trust 2013-2022, All Rights Reserved

from ietf.help import views
from ietf.utils.urls import url
Expand All @@ -9,6 +7,5 @@
url(r'^state/(?P<doc>[-\w]+)/(?P<type>[-\w]+)/?$', views.state),
url(r'^state/(?P<doc>[-\w]+)/?$', views.state),
url(r'^state/?$', views.state_index),
url(r'^personal-information/?$', TemplateView.as_view(template_name='help/personal-information.html'), name='personal-information'),
]

22 changes: 1 addition & 21 deletions ietf/ietfauth/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,7 @@ def get_person_form(*args, **kwargs):
class PersonForm(forms.ModelForm):
class Meta:
model = Person
exclude = exclude_list
widgets = {
'consent': forms.widgets.CheckboxInput,
}
exclude = exclude_list

def __init__(self, *args, **kwargs):
super(PersonForm, self).__init__(*args, **kwargs)
Expand All @@ -120,10 +117,6 @@ def __init__(self, *args, **kwargs):

self.fields['pronouns_selectable'] = forms.MultipleChoiceField(label='Pronouns', choices = [(option, option) for option in ["he/him", "she/her", "they/them"]], widget=forms.CheckboxSelectMultiple, required=False)

for f in ['name', 'ascii', 'ascii_short', 'biography', 'photo', 'photo_thumb', 'pronouns_selectable']:
if f in self.fields:
self.fields[f].label = mark_safe(self.fields[f].label + ' <a href="#pi" aria-label="!"><i class="bi bi-exclamation-circle"></i></a>')

self.unidecoded_ascii = False

if self.data and not self.data.get("ascii", "").strip():
Expand Down Expand Up @@ -155,19 +148,6 @@ def clean_ascii_short(self):
prevent_system_name(name)
return ascii_cleaner(name)

def clean_consent(self):
consent = self.cleaned_data.get('consent')
require_consent = (
self.cleaned_data.get('name') != person.name_from_draft
or self.cleaned_data.get('ascii') != person.name_from_draft
or self.cleaned_data.get('biography')
or self.cleaned_data.get('pronouns_selectable')
or self.cleaned_data.get('pronouns_freetext')
)
if consent == False and require_consent:
raise forms.ValidationError("In order to modify your profile with data that require consent, you must permit the IETF to use the uploaded data.")
return consent

def clean(self):
if self.cleaned_data.get("pronouns_selectable") and self.cleaned_data.get("pronouns_freetext"):
self.add_error("pronouns_freetext", "Either select from the pronoun checkboxes or provide a custom value, but not both")
Expand Down
3 changes: 1 addition & 2 deletions ietf/ietfauth/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ def test_ietfauth_profile(self):
"pronouns_freetext": "foo/bar",
"affiliation": "Test Org",
"active_emails": email_address,
"consent": True,
}

# edit details - faulty ASCII
Expand Down Expand Up @@ -1011,4 +1010,4 @@ def test_has_role_empty_role_names(self):
"""has_role is False if role_names is empty"""
role = RoleFactory(name_id='secr', group__acronym='secretariat')
self.assertTrue(has_role(role.person.user, ['Secretariat']), 'Test is broken')
self.assertFalse(has_role(role.person.user, []), 'has_role() should return False when role_name is empty')
self.assertFalse(has_role(role.person.user, []), 'has_role() should return False when role_name is empty')
19 changes: 0 additions & 19 deletions ietf/ietfauth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
from django.contrib.sites.models import Site
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.urls import reverse as urlreverse
from django.utils.safestring import mark_safe
from django.http import Http404, HttpResponseRedirect, HttpResponseForbidden
from django.shortcuts import render, redirect, get_object_or_404
from django.utils.encoding import force_bytes
Expand Down Expand Up @@ -699,7 +698,6 @@ def login(request, extra_context=None):
which is not recognized as a valid password hash.
"""

require_consent = []
if request.method == "POST":
form = AuthenticationForm(request, data=request.POST)
username = form.data.get('username')
Expand All @@ -721,11 +719,6 @@ def login(request, extra_context=None):
user = u2
#
if user:
try:
if user.person and not user.person.consent:
require_consent = user.person.needs_consent()
except ObjectDoesNotExist:
pass
try:
identify_hasher(user.password)
except ValueError:
Expand All @@ -742,18 +735,6 @@ def login(request, extra_context=None):
except Person.DoesNotExist:
logout(request)
response = render(request, 'registration/missing_person.html')
if require_consent:
messages.warning(request, mark_safe(f'''

You have personal information associated with your account which is not
derived from draft submissions or other ietf work, namely: %s. Please go
to your <a href="{urlreverse("ietf.ietfauth.views.profile")}">account profile</a> and review your
personal information, then scoll to the bottom and check the 'confirm'
checkbox and submit the form, in order to to indicate that that the
provided personal information may be used and displayed within the IETF
datatracker.

''' % ', '.join(require_consent)))
return response

@login_required
Expand Down
2 changes: 1 addition & 1 deletion ietf/person/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def plain_name(self, obj):
prefix, first, middle, last, suffix = name_parts(obj.name)
return "%s %s" % (first, last)
list_display = ["name", "short", "plain_name", "time", "user", ]
fields = ("user", "time", "name", "plain", "name_from_draft", "ascii", "ascii_short", "pronouns_selectable", "pronouns_freetext", "biography", "photo", "photo_thumb", "consent",)
fields = ("user", "time", "name", "plain", "name_from_draft", "ascii", "ascii_short", "pronouns_selectable", "pronouns_freetext", "biography", "photo", "photo_thumb",)
readonly_fields = ("name_from_draft", )
search_fields = ["name", "ascii"]
raw_id_fields = ["user"]
Expand Down
21 changes: 21 additions & 0 deletions ietf/person/migrations/0026_drop_consent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright The IETF Trust 2022, All Rights Reserved

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('person', '0025_chat_and_polls_apikey'),
]

operations = [
migrations.RemoveField(
model_name='historicalperson',
name='consent',
),
migrations.RemoveField(
model_name='person',
name='consent',
),
]
18 changes: 18 additions & 0 deletions ietf/person/migrations/0027_personevent_drop_consent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright The IETF Trust 2022, All Rights Reserved

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('person', '0026_drop_consent'),
]

operations = [
migrations.AlterField(
model_name='personevent',
name='type',
field=models.CharField(choices=[('apikey_login', 'API key login'), ('email_address_deactivated', 'Email address deactivated')], max_length=50),
),
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 2.2.28 on 2022-10-17 10:18
# Copyright The IETF Trust 2022, All Rights Reserved

from django.db import migrations, models
import ietf.person.models
Expand All @@ -7,7 +7,7 @@
class Migration(migrations.Migration):

dependencies = [
('person', '0025_chat_and_polls_apikey'),
('person', '0027_personevent_drop_consent'),
]

operations = [
Expand Down
30 changes: 1 addition & 29 deletions ietf/person/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from django.db import models
from django.template.loader import render_to_string
Expand Down Expand Up @@ -58,7 +58,6 @@ class Person(models.Model):
photo = models.ImageField(storage=NoLocationMigrationFileSystemStorage(), upload_to=settings.PHOTOS_DIRNAME, blank=True, default=None)
photo_thumb = models.ImageField(storage=NoLocationMigrationFileSystemStorage(), upload_to=settings.PHOTOS_DIRNAME, blank=True, default=None)
name_from_draft = models.CharField("Full Name (from submission)", null=True, max_length=255, editable=False, help_text="Name as found in a draft submission.")
consent = models.BooleanField("I hereby give my consent to the use of the personal details I have provided (photo, bio, name, pronouns, email) within the IETF Datatracker", null=True, default=None)

def __str__(self):
return self.plain_name()
Expand Down Expand Up @@ -194,32 +193,6 @@ def expired_drafts(self):
from ietf.doc.models import Document
return Document.objects.filter(documentauthor__person=self, type='draft', states__slug__in=['repl', 'expired', 'auth-rm', 'ietf-rm']).distinct().order_by('-time')

def needs_consent(self):
"""
Returns an empty list or a list of fields which holds information that
requires consent to be given.
"""
needs_consent = []
if self.name != self.name_from_draft:
needs_consent.append("full name")
if self.ascii != self.name_from_draft:
needs_consent.append("ascii name")
if self.biography and not (self.role_set.exists() or self.rolehistory_set.exists()):
needs_consent.append("biography")
if self.user_id:
needs_consent.append("login")
try:
if self.user.communitylist_set.exists():
needs_consent.append("draft notification subscription(s)")
except ObjectDoesNotExist:
pass
for email in self.email_set.all():
if not email.origin.split(':')[0] in ['author', 'role', 'reviewer', 'liaison', 'shepherd', ]:
needs_consent.append("email address(es)")
break
if self.pronouns_freetext or self.pronouns_selectable:
needs_consent.append("pronouns")
return needs_consent

def save(self, *args, **kwargs):
created = not self.pk
Expand Down Expand Up @@ -428,7 +401,6 @@ def __str__(self):

PERSON_EVENT_CHOICES = [
("apikey_login", "API key login"),
("gdpr_notice_email", "GDPR consent request email sent"),
("email_address_deactivated", "Email address deactivated"),
]

Expand Down
2 changes: 1 addition & 1 deletion ietf/person/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def merge_persons(request, source, target, file=sys.stdout, verbose=False):
dedupe_aliases(target)

# copy other attributes
for field in ('ascii','ascii_short', 'biography', 'photo', 'photo_thumb', 'name_from_draft', 'consent'):
for field in ('ascii','ascii_short', 'biography', 'photo', 'photo_thumb', 'name_from_draft'):
if getattr(source,field) and not getattr(target,field):
setattr(target,field,getattr(source,field))
target.save()
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 @@ -104,12 +104,6 @@
</a>
</li>
{% endif %}
<li>
<a class="dropdown-item {% if flavor != 'top' %} text-wrap link-primary{% endif %}"
href="{% url 'personal-information' %}">
Handling of personal information
</a>
</li>
{% endif %}
{% if not request.user.is_authenticated %}
<li>
Expand Down
86 changes: 0 additions & 86 deletions ietf/templates/help/personal-information.html

This file was deleted.

6 changes: 3 additions & 3 deletions ietf/templates/registration/confirm_profile_update.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% extends "base.html" %}
{% load origin textfilters %}
{% block title %}Profile update successful{% endblock %}
{% block title %}Account information update successful{% endblock %}
{% block content %}
{% origin %}
<h1>Profile update successful</h1>
<h1>Account information update successful</h1>
<p class="my-3">
Your account has been updated to reflect the changes you submitted.
</p>
Expand All @@ -14,5 +14,5 @@ <h1>Profile update successful</h1>
</p>
{% endfor %}
<a class="btn btn-primary"
href="{% url "ietf.ietfauth.views.profile" %}">Edit profile</a>
href="{% url "ietf.ietfauth.views.profile" %}">Edit account information</a>
{% endblock %}
Loading