diff --git a/ietf/ietfauth/views.py b/ietf/ietfauth/views.py index c71f44f35..a1173f7d3 100644 --- a/ietf/ietfauth/views.py +++ b/ietf/ietfauth/views.py @@ -46,10 +46,11 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth.hashers import identify_hasher from django.contrib.auth.models import User -from django.contrib.auth.views import login as django_login +from django.contrib.auth.views import LoginView from django.contrib.sites.models import Site from django.core.validators import ValidationError from django.urls import reverse as urlreverse +from django.utils.safestring import mark_safe from django.http import Http404, HttpResponseRedirect #, HttpResponse, from django.shortcuts import render, redirect, get_object_or_404 @@ -583,6 +584,22 @@ def login(request, extra_context=None): form = AuthenticationForm(request, data=request.POST) username = form.data.get('username') user = User.objects.filter(username=username).first() + # + require_consent = [] + if user.person and not user.person.consent: + person = user.person + if person.name != person.name_from_draft: + require_consent.append("full name") + elif person.ascii != person.name_from_draft: + require_consent.append("ascii name") + elif person.biography: + require_consent.append("biography") + elif user.communitylist_set.exists(): + require_consent.append("draft notification subscription(s)") + else: + for email in person.email_set.all(): + if not email.origin.split(':')[0] in ['author', 'role', 'reviewer', 'liaison', 'shepherd', ]: + require_consent.append("email address(es)") if user: try: identify_hasher(user.password) @@ -593,8 +610,19 @@ def login(request, extra_context=None): "Please use the password reset link below " "to set a new password for your account.", } + response = LoginView.as_view(extra_context=extra_context)(request) + if isinstance(response, HttpResponseRedirect) and user.is_authenticated(): + if require_consent: + messages.warning(request, mark_safe(""" - return django_login(request, extra_context=extra_context) + 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 account profile and review your + personal information, and confirm that it may be used and displayed + within the IETF datatracker. + + """ % ', '.join(require_consent))) + return response @login_required @person_required diff --git a/ietf/static/ietf/css/ietf.css b/ietf/static/ietf/css/ietf.css index 8441ee635..0f9ae9635 100644 --- a/ietf/static/ietf/css/ietf.css +++ b/ietf/static/ietf/css/ietf.css @@ -658,6 +658,11 @@ ul.list-inline li { max-width: 85ex; } +.photo { + max-width: 200px; +} + + .bio-photo { float: left; margin: 0.3em 1em 0.5em 0.1em; diff --git a/ietf/templates/registration/edit_profile.html b/ietf/templates/registration/edit_profile.html index fe9482383..b18b7706d 100644 --- a/ietf/templates/registration/edit_profile.html +++ b/ietf/templates/registration/edit_profile.html @@ -77,6 +77,19 @@ + {% if person.photo %} +
+ +
+

+ + Photo of {{ person }} + +

+
+
+ {% endif %} +
{{person|is_nomcom_eligible|yesno:'Yes,No,No'}}
@@ -89,20 +102,24 @@
-
+
- + {% for email in emails %} - + + {% endfor %}
PrimaryActiveAddress
PrimaryActiveAddressOrigin
{{ email }} + {% if email.origin == person.user.username or email.origin == '' %}†{% endif %} + {{ email }} + {{ email.origin|default:'(unknown)' }}
-
-
Note: Email addresses cannot be deleted, only deactivated.
+
+
Note: Email addresses cannot be deleted in this form, only deactivated.
@@ -146,11 +163,11 @@ $(document).ready(function() { $("input[name=active_emails]").on("change keypress click", function () { if (this.checked) { - $(this).parent().parent().addClass("text-success");; - $(this).parent().parent().removeClass("text-danger line-through"); + $(this).parent().next().addClass("text-success");; + $(this).parent().next().removeClass("text-danger line-through"); } else { - $(this).parent().parent().addClass("text-danger line-through"); - $(this).parent().parent().removeClass("text-success"); + $(this).parent().next().addClass("text-danger line-through"); + $(this).parent().next().removeClass("text-success"); } }).trigger("change");