From c14ba9d20e21b985c30377f619eac0199bfa5864 Mon Sep 17 00:00:00 2001 From: johnyu95 Date: Mon, 13 May 2024 15:38:04 -0400 Subject: [PATCH 1/2] Added missing name modal for public NYC.ID accounts --- app/request/views.py | 3 +++ app/templates/auth/concurrent_session_modal.html | 1 - app/templates/auth/missing_name_modal.html | 15 +++++++++++++++ app/templates/base.html | 1 + app/templates/base.js.html | 7 +++++++ app/templates/request/_edit_requester_info.html | 6 +++++- 6 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 app/templates/auth/missing_name_modal.html diff --git a/app/request/views.py b/app/request/views.py index a56510315..87d18daac 100644 --- a/app/request/views.py +++ b/app/request/views.py @@ -164,6 +164,9 @@ def new(): else current_app.config["APP_TIMEZONE"] ) if current_user.is_public: + if current_user.first_name == '' or current_user.last_name == '': + flash('Missing first or last name. Please update your name on the Profile page.', category='danger') + return redirect(url_for("request.new")) request_id = create_request( escape(form.request_title.data), escape(form.request_description.data), diff --git a/app/templates/auth/concurrent_session_modal.html b/app/templates/auth/concurrent_session_modal.html index 2f1d90e66..7900e5727 100644 --- a/app/templates/auth/concurrent_session_modal.html +++ b/app/templates/auth/concurrent_session_modal.html @@ -4,7 +4,6 @@ {% include 'auth/concurrent_session_modal.html' %} +{% include 'auth/missing_name_modal.html' %}
{% block content %} {% endblock %} diff --git a/app/templates/base.js.html b/app/templates/base.js.html index c9c83dfe1..50fa384b0 100644 --- a/app/templates/base.js.html +++ b/app/templates/base.js.html @@ -9,6 +9,10 @@ "href", webServicesUrl + "/account/user/profile.htm?returnOnSave=true&target=" + btoa(window.location.href) ); + $("#continue-to-profile").attr( + "href", + webServicesUrl + "/account/user/profile.htm?returnOnSave=true&target=" + btoa(window.location.origin + '/auth/logout') + ); {% endif %} $.ajaxSetup({ @@ -50,6 +54,9 @@ {% if duplicate_session %} $("#concurrent-session-modal").modal("show"); {% endif %} + {% if current_user.first_name == '' or current_user.last_name == '' %} + $("#missing-name-modal").modal("show"); + {% endif %} {% endif %} diff --git a/app/templates/request/_edit_requester_info.html b/app/templates/request/_edit_requester_info.html index 0bbf4ed2f..58744831d 100644 --- a/app/templates/request/_edit_requester_info.html +++ b/app/templates/request/_edit_requester_info.html @@ -4,7 +4,11 @@

Requester

- {{ request.requester.name | title | safe }} + {% if request.requester.first_name == '' or request.requester.last_name == '' %} + Missing Name + {% else %} + {{ request.requester.name | title | safe }} + {% endif %}

From de63174ead94d8e96f7db25d201800968496a689 Mon Sep 17 00:00:00 2001 From: johnyu95 Date: Mon, 13 May 2024 16:04:48 -0400 Subject: [PATCH 2/2] Updated logic check for missing name modal --- app/templates/base.js.html | 4 ++-- app/templates/request/_edit_requester_info.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/templates/base.js.html b/app/templates/base.js.html index 50fa384b0..09517d039 100644 --- a/app/templates/base.js.html +++ b/app/templates/base.js.html @@ -11,7 +11,7 @@ ); $("#continue-to-profile").attr( "href", - webServicesUrl + "/account/user/profile.htm?returnOnSave=true&target=" + btoa(window.location.origin + '/auth/logout') + webServicesUrl + "/account/user/profile.htm?returnOnSave=true&target=" + btoa(window.location.origin + "/auth/logout") ); {% endif %} @@ -54,7 +54,7 @@ {% if duplicate_session %} $("#concurrent-session-modal").modal("show"); {% endif %} - {% if current_user.first_name == '' or current_user.last_name == '' %} + {% if current_user.is_public and (current_user.first_name == "" or current_user.last_name == "") %} $("#missing-name-modal").modal("show"); {% endif %} {% endif %} diff --git a/app/templates/request/_edit_requester_info.html b/app/templates/request/_edit_requester_info.html index 58744831d..93f8e0607 100644 --- a/app/templates/request/_edit_requester_info.html +++ b/app/templates/request/_edit_requester_info.html @@ -4,7 +4,7 @@

Requester

- {% if request.requester.first_name == '' or request.requester.last_name == '' %} + {% if request.requester.first_name == "" or request.requester.last_name == "" %} Missing Name {% else %} {{ request.requester.name | title | safe }}