Skip to content

Commit

Permalink
Merge pull request #581 from CityOfNewYork/johnyu95-public-nycid-miss…
Browse files Browse the repository at this point in the history
…ing-name

Public NYC.ID Missing Name
  • Loading branch information
johnyu95 authored May 13, 2024
2 parents 640444c + de63174 commit 3e8f9ad
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/request/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 0 additions & 1 deletion app/templates/auth/concurrent_session_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" id="concurrent-session-label">You are currently logged in to another session</h4>
</h4>
</div>
<div class="modal-body">
For your security, we have logged you out of your other active sessions.
Expand Down
15 changes: 15 additions & 0 deletions app/templates/auth/missing_name_modal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div id="missing-name-modal" class="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="missing-name-label">Profile Missing Name</h4>
</div>
<div class="modal-body">
Error, your profile is missing a name. Please click continue to update your profile.
</div>
<div class="modal-footer">
<a class="btn btn-default" type="button" id="continue-to-profile" href="#">Continue</a>
</div>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
{% endwith %}
</div>
{% include 'auth/concurrent_session_modal.html' %}
{% include 'auth/missing_name_modal.html' %}
<div class="wrapper">
{% block content %}
{% endblock %}
Expand Down
7 changes: 7 additions & 0 deletions app/templates/base.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -50,6 +54,9 @@
{% if duplicate_session %}
$("#concurrent-session-modal").modal("show");
{% endif %}
{% if current_user.is_public and (current_user.first_name == "" or current_user.last_name == "") %}
$("#missing-name-modal").modal("show");
{% endif %}
{% endif %}


Expand Down
6 changes: 5 additions & 1 deletion app/templates/request/_edit_requester_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ <h4>Requester</h4>
<h4>
<a data-target="#requesterModal" data-toggle="modal" class="MainNavText" id="MainNavHelp"
href="#requesterModal">
{{ request.requester.name | title | safe }}
{% if request.requester.first_name == "" or request.requester.last_name == "" %}
Missing Name
{% else %}
{{ request.requester.name | title | safe }}
{% endif %}
</a>
</h4>
</div>
Expand Down

0 comments on commit 3e8f9ad

Please sign in to comment.