diff --git a/hc/accounts/views.py b/hc/accounts/views.py index fe77e900..724275c9 100644 --- a/hc/accounts/views.py +++ b/hc/accounts/views.py @@ -223,7 +223,7 @@ def profile(request): "2fa_status": "default", "added_credential_name": request.session.pop("added_credential_name", ""), "removed_credential_name": request.session.pop("removed_credential_name", ""), - "credentials": request.user.credentials.order_by("id"), + "credentials": list(request.user.credentials.order_by("id")), "use_2fa": settings.RP_ID, } @@ -658,7 +658,7 @@ def remove_credential(request, code): credential.delete() return redirect("hc-profile") - ctx = {"credential": credential} + ctx = {"credential": credential, "is_last": request.user.credentials.count() == 1} return render(request, "accounts/remove_credential.html", ctx) diff --git a/templates/accounts/add_credential.html b/templates/accounts/add_credential.html index 0e9230de..61353d02 100644 --- a/templates/accounts/add_credential.html +++ b/templates/accounts/add_credential.html @@ -3,7 +3,6 @@ {% block content %} -{{ registration_dict|json_script:"registration" }}