[java-identity-provider] 19/28: Set focus to password field if username populated.

Scott Cantor cantor.2 at osu.edu
Wed Jan 31 14:52:05 UTC 2024


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch dev/thymeleaf
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=97b5587f0113c1710c561580a83943e6f14947fe

commit 97b5587f0113c1710c561580a83943e6f14947fe
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jan 9 15:39:56 2024 -0500

    Set focus to password field if username populated.
---
 .../resources/net/shibboleth/idp/module/views/login.vm    | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/views/login.vm b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/views/login.vm
index ceabbd6f1..1cf1eb4f0 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/views/login.vm
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/views/login.vm
@@ -73,11 +73,11 @@ $response.addHeader("Content-Security-Policy", "script-src-attr 'unsafe-hashes'
                     #parse("login-error.vm")
 
                     <label for="username">#springMessageText("idp.login.username", "Username")</label>
-                    <input id="username" name="j_username" type="text"
+                    <input type="text" id="username" name="j_username"
                         value="#if($username)$encoder.encodeForHTML($username)#end" />
                         
                     <label for="password">#springMessageText("idp.login.password", "Password")</label>
-                    <input type="password" name="j_password" id="password" value="" />
+                    <input type="password" id="password" name="j_password" value="" />
     
                     ## You may need to modify this to taste, such as changing the flow name checked to authn/MFA.
                     #if (!$authenticationContext.getActiveResults().containsKey('authn/Password'))
@@ -110,10 +110,13 @@ $response.addHeader("Content-Security-Policy", "script-src-attr 'unsafe-hashes'
 
         <script #if ($nonce)nonce="$nonce"#end>
         <!--
-        const input = document.getElementById('username');
-        const end = input.value.length;
-        input.setSelectionRange(end, end);
-        input.focus();
+        const ufield = document.getElementById('username');
+        const pfield = document.getElementById('password');
+        if (ufield.value == null) {
+            ufield.focus();
+        } else {
+            pfield.focus();
+        }
         // -->
         </script>
         

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list