From bf28242d9de5d61ca25d7d1338f75d12e66bc77c Mon Sep 17 00:00:00 2001 From: Long Vu Date: Thu, 6 Feb 2025 13:51:17 -0500 Subject: [PATCH] templates/login.html: allow adding extra HTML Input Attributes for Username and Password field With this change, if we set ``` {% block username_input_attribs %}pattern="[a-z0-9]+" placeholder="do not use email address, use your username"{% endblock username_input_attribs %} ``` We will get the following generated code ``` --- share/jupyterhub/templates/login.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/share/jupyterhub/templates/login.html b/share/jupyterhub/templates/login.html index d9728733..841ccf07 100644 --- a/share/jupyterhub/templates/login.html +++ b/share/jupyterhub/templates/login.html @@ -43,13 +43,19 @@ class="form-control" name="username" val="{{ username }}" - autofocus="autofocus" /> + autofocus="autofocus" + {# allow adding extra HTML Input Attributes (pattern, placeholder, title, minlenght, maxlenght, ...) #} + {% block username_input_attribs %}{% endblock username_input_attribs %} + /> + id="password_input" + {# allow adding extra HTML Input Attributes (pattern, placeholder, title, minlenght, maxlenght, ...) #} + {% block password_input_attribs %}{% endblock password_input_attribs %} + /> {% if authenticator.request_otp %}