github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/assets/scripts/oidc-twofactor.js (about)

     1  ;(function (w, d) {
     2    const form = d.getElementById('oidc-twofactor-form')
     3    const trustedTokenInput = d.getElementById('trusted-device-token')
     4  
     5    // Set the trusted device token from the localstorage in the form if it exists
     6    try {
     7      const storage = w.localStorage
     8      const deviceToken = storage.getItem('trusted-device-token') || ''
     9      trustedTokenInput.value = deviceToken
    10    } catch (e) {
    11      console.log(e) // do nothing
    12    }
    13  
    14    form.submit()
    15  })(window, document)