[java-idp-plugin-webauthn] branch main updated: Add error message to registration view

Phil Smart philip.smart at jisc.ac.uk
Fri Mar 1 10:52:30 UTC 2024


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

philsmart pushed a commit to branch main
in repository java-idp-plugin-webauthn.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-webauthn.git;a=commit;h=835db9102dd1cdb651c9f7ae8965de9a35e505ba

The following commit(s) were added to refs/heads/main by this push:
     new 835db91  Add error message to registration view
835db91 is described below

commit 835db9102dd1cdb651c9f7ae8965de9a35e505ba
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Mar 1 10:52:28 2024 +0000

    Add error message to registration view
---
 .../plugin/authn/webauthn/views/webauthn-register.vm | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-register.vm b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-register.vm
index 99a4fbc..9b9a45d 100644
--- a/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-register.vm
+++ b/webauthn-impl/src/main/resources/net/shibboleth/idp/plugin/authn/webauthn/views/webauthn-register.vm
@@ -44,13 +44,21 @@
              #end             
              await create(pkCredOptionsParsed)
                      .then(function (attestation){
-                         var nickname = prompt("Credential Nickname");
+                         var nickname = prompt('#springMessageText("idp.webauthn.register.credential.nickanme", "Credential Nickname")');
                          document.getElementById("credentialNickname").value = nickname;
                          document.getElementById("authenticatorAttestation").value = JSON.stringify(attestation);    
                          document.getElementById("registrationSubmit").click();
                      }).catch(function (err){
-                         console.error(err)
-                    });   
+                         #if($debug == "true")
+                            console.error(err);
+                         #end                           
+                         document.getElementById("error_div").classList.remove('hidden')
+                         document.getElementById("error_message").innerHTML = err.message;
+                         setTimeout(function () {
+                            document.getElementById("error_div").classList.add('hidden')                            
+                        }.bind(this), 4000); 
+                     });    
+   
          
           };
          
@@ -133,6 +141,12 @@
                             </form>
                         </div>                        
                      </div>
+                    
+                     <div class="hidden output-message output--error" id="error_div">
+                        <span id="error_message"></span>
+                     </div>
+                    
+                    
                      <form id="authenticatorAttestationForm" action="$flowExecutionUrl" method="post">
                         #parse("csrf/csrf.vm")
                         <input type="hidden" id="credentialNickname" name="credentialNickname"/>

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


More information about the commits mailing list