Password entry field created using HTMLService loses type = password

I am creating a reset password form for use by school staff in Google Apps for Education. I am using the HTMLService API to import an html file and use it as a template. Part of this file is the table:

<table id=passwords> <tr> <td>New Password</td> <td> <input name='password1' id='password1' type='password'/> </td> </tr> <tr> <td>Confirm New Password</td> <td> <input name='password2' id='password2' type='password'/> </td> </tr> </table> 

When I show this as a gadget on the Google Sites page, type='password' is lost from html, so passwords are not hidden when the user enters them:

  <table id="passwords-caja-guest-0___"> <tbody><tr> <td>New Password</td> <td> <input autocomplete="off" id="password1-caja-guest-0___" name="password1"> </td> </tr> <tr> <td>Confirm New Password</td> <td> <input autocomplete="off" id="password2-caja-guest-0___" name="password2"> </td> </tr> </tbody></table> 

Instead, I can switch to using UIService, which has a password widget that hides the password, but then other people who will support the site after me will also need to learn the UIService for a rather long API.

So, I'm looking for ideas on how to hide password entry in this context (i.e. just show asterisks or tokens when a user enters a password).

+4
source share
1 answer

Congratulations! You sent the very first error in the new HtmlService :).

It seems that at the disinfection step, type = password is lost. It is registered as error 1487

As a workaround, this will work well today.

 <input name='password1' id='password1' /> <script>document.getElementById('password1').type='password'</script> 

That is, type setting in JavaScript works. However, this is a temporary solution; we will fix the basic error as soon as possible. Thanks for the report.

Update. The original error was fixed in Caja, and we will pick it up in the next version of Script applications.

+4
source

All Articles