[java-identity-provider] branch main updated: Add Javascript to set focus and selection point to username field.

Scott Cantor cantor.2 at osu.edu
Tue Jan 9 14:21:34 UTC 2024


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

scantor pushed a commit to branch main
in repository java-identity-provider.

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

The following commit(s) were added to refs/heads/main by this push:
     new e0a550c33 Add Javascript to set focus and selection point to username field.
e0a550c33 is described below

commit e0a550c3370394d41f4be8da0e4c25ae4aa9fec1
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jan 9 09:21:31 2024 -0500

    Add Javascript to set focus and selection point to username field.
---
 .../main/resources/net/shibboleth/idp/module/views/login.vm  | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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 857422dc7..ceabbd6f1 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
@@ -22,6 +22,8 @@
 #set ($rpContext = $profileRequestContext.getSubcontext('net.shibboleth.profile.context.RelyingPartyContext'))
 #set ($username = $authenticationContext.ensureSubcontext('net.shibboleth.idp.authn.context.UsernamePasswordContext').getUsername())
 ##
+#set ($nonce = $cspNonce.generateIdentifier())
+$response.addHeader("Content-Security-Policy", "script-src-elem 'nonce-$nonce'")
 #set ($onClick = "this.childNodes[0].nodeValue='#springMessageText('idp.login.pleasewait', 'Logging in, please wait...')'")
 $response.addHeader("Content-Security-Policy", "script-src-attr 'unsafe-hashes' 'sha256-$cspDigester.apply($onClick)'")
 <!DOCTYPE html>
@@ -105,5 +107,15 @@ $response.addHeader("Content-Security-Policy", "script-src-attr 'unsafe-hashes'
                 <p>#springMessageText("idp.footer", "Insert your footer text here.")</p>
             </div>
         </footer>
+
+        <script #if ($nonce)nonce="$nonce"#end>
+        <!--
+        const input = document.getElementById('username');
+        const end = input.value.length;
+        input.setSelectionRange(end, end);
+        input.focus();
+        // -->
+        </script>
+        
      </body>
 </html>
\ No newline at end of file

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


More information about the commits mailing list