Skip to content

Commit

Permalink
Prevent empty <ul> from being rendered in profile.html
Browse files Browse the repository at this point in the history
Empty <ul> was being rendered when backup_phones == None
  • Loading branch information
DanielSwain authored and claudep committed Jan 17, 2024
1 parent e9dba63 commit 45cfc13
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions two_factor/templates/two_factor/profile/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ <h1>{% block title %}{% trans "Account Security" %}{% endblock %}</h1>
<h2>{% trans "Backup Phone Numbers" %}</h2>
<p>{% blocktrans trimmed %}If your primary method is not available, we are able to
send backup tokens to the phone numbers listed below.{% endblocktrans %}</p>
<ul>
{% for phone in backup_phones %}
<li>
{{ phone|as_action }}
<form method="post" action="{% url 'two_factor:phone_delete' phone.id %}"
{% if backup_phones %}
<ul>
{% for phone in backup_phones %}
<li>
{{ phone|as_action }}
<form method="post" action="{% url 'two_factor:phone_delete' phone.id %}"
onsubmit="return confirm({% trans 'Are you sure?' %})">
{% csrf_token %}
<button class="btn btn-sm btn-warning"
{% csrf_token %}
<button class="btn btn-sm btn-warning"
type="submit">{% trans "Unregister" %}</button>
</form>
</li>
{% endfor %}
</ul>
</form>
</li>
{% endfor %}
</ul>
{% endif %}
<p><a href="{% url 'two_factor:phone_create' %}"
class="btn btn-info">{% trans "Add Phone Number" %}</a></p>
{% endif %}
Expand Down

0 comments on commit 45cfc13

Please sign in to comment.