aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2023-06-18 11:50:17 -0400
committerB. Stack <bgstack15@gmail.com>2023-06-24 08:26:50 -0400
commit35ed91fbd1065e92817362dce1aab244911c6444 (patch)
tree9c8d3f3b994b6a10d7ef2df2d47c2dde5b9dcad7
parentdisallow ext-auth user to change nickname (diff)
downloadnewspipe-35ed91fbd1065e92817362dce1aab244911c6444.tar.gz
newspipe-35ed91fbd1065e92817362dce1aab244911c6444.tar.bz2
newspipe-35ed91fbd1065e92817362dce1aab244911c6444.zip
display external-auth on user for admin edit-user page
-rw-r--r--newspipe/templates/admin/create_user.html2
-rw-r--r--newspipe/web/views/admin.py4
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 %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
{{ form.password.label }}
- {{ form.password(class_="form-control") }} {% for error in form.password.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
+ {% if pw_disabled %}{{ form.password(class_="form-control",disabled=True) }}{% else %}{{ form.password(class_="form-control") }}{% endif %} {% for error in form.password.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %}
{{ form.automatic_crawling.label }}
{{ form.automatic_crawling(class_="form-check-input") }} {% for error in form.automatic_crawling.errors %} <span style="color: red;">{{ error }}<br /></span>{% 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 <i>%(nick)s</i>", 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"])
bgstack15