From ab5ab11b68b359de2a443e464affd244bea53096 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Sun, 18 Jun 2023 11:50:17 -0400 Subject: display external-auth on user for admin edit-user page --- newspipe/templates/admin/create_user.html | 2 +- newspipe/web/views/admin.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/newspipe/templates/admin/create_user.html b/newspipe/templates/admin/create_user.html index 2cfe4518..550cfd1f 100644 --- a/newspipe/templates/admin/create_user.html +++ b/newspipe/templates/admin/create_user.html @@ -9,7 +9,7 @@ {{ form.nickname(class_="form-control") }} {% for error in form.nickname.errors %} {{ error }}
{% endfor %} {{ form.password.label }} - {{ form.password(class_="form-control") }} {% for error in form.password.errors %} {{ error }}
{% endfor %} + {% if pw_disabled %}{{ form.password(class_="form-control",disabled=True) }}{% else %}{{ form.password(class_="form-control") }}{% endif %} {% for error in form.password.errors %} {{ error }}
{% endfor %} {{ form.automatic_crawling.label }} {{ form.automatic_crawling(class_="form-check-input") }} {% for error in form.automatic_crawling.errors %} {{ error }}
{% endfor %} diff --git a/newspipe/web/views/admin.py b/newspipe/web/views/admin.py index b35a3f96..6f412901 100644 --- a/newspipe/web/views/admin.py +++ b/newspipe/web/views/admin.py @@ -46,10 +46,12 @@ def user_form(user_id=None): user = UserController().get(id=user_id) form = UserForm(obj=user) message = gettext("Edit the user %(nick)s", nick=user.nickname) + if user.external_auth: + message += f" (external auth type: {user.external_auth})" else: form = UserForm() message = gettext("Add a new user") - return render_template("/admin/create_user.html", form=form, message=message) + return render_template("/admin/create_user.html", form=form, message=message, pw_disabled = bool(user.external_auth)) @admin_bp.route("/user/create", methods=["POST"]) -- cgit