From 15fb7f45b85f8d984233bf8fa0227da949d976c5 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 3 Feb 2023 19:51:50 -0600 Subject: [PATCH] Fix auto-focus username for login form --- tailbone/templates/login.mako | 10 ++++++++++ tailbone/views/auth.py | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/tailbone/templates/login.mako b/tailbone/templates/login.mako index e8f06848..f53de560 100644 --- a/tailbone/templates/login.mako +++ b/tailbone/templates/login.mako @@ -57,5 +57,15 @@ +<%def name="modify_this_page_vars()"> + + + ${parent.body()} diff --git a/tailbone/views/auth.py b/tailbone/views/auth.py index b16ff539..1a1c406d 100644 --- a/tailbone/views/auth.py +++ b/tailbone/views/auth.py @@ -122,6 +122,10 @@ class AuthenticationView(View): 'tailbone', 'main_image_url', default=self.request.static_url('tailbone:static/img/home_logo.png')) + # nb. hacky..but necessary, to add the ref, for autofocus + dform = form.make_deform_form() + dform['username'].widget.attributes = {'ref': 'username'} + return { 'form': form, 'referrer': referrer,