Skip to content

Instantly share code, notes, and snippets.

@sk22
Last active September 15, 2017 07:57
Show Gist options
  • Save sk22/82075daa440b4c41a3488e2de997236a to your computer and use it in GitHub Desktop.
Save sk22/82075daa440b4c41a3488e2de997236a to your computer and use it in GitHub Desktop.
WebUntis prompt to save the password

Chrome WebUntis password save prompt

The Problem

When logging into WebUntis, Chrome doesn't prompt to save your username and password as it does on other websites. So whenever you open up WebUntis (for some reason the session doesn't last long), you have newly enter your username and password every time. So why do this if Chrome could just enter it for you?

Now I tried to alter that code so Chrome can save the username-password combination. The problem turned out to be that the Login button is a button element, not an input with type submit.

Workaround

What I did to make it work for me is to open the Chrome DevTools (CTRL+Shift+I or F12) and enter my credentials. Then, right click the Login button and click Inspect. Now you see that the button element is selected. Double-click the word button in <button type="submit" and change it to input. Leave the rest of the attributes as they are.

That change made, press the login button (whose name should have changed to Submit because of the way the input element works). You should see Chrome suggest saving the username and password you entered. It should now autofill every time you try to log in. Yay!

Without DevTools / on mobile

Open the login popup and enter your credentials. Click the address bar. Clear everything out and type javascript:. Directly after that, paste the following code:

(function(){let el=document.querySelector('#un-login-popover button[type=submit]');el.outerHTML=el.outerHTML.replace('<button','<input');})()

The reason you need to type out javascript: is that Chrome doesn't allow it being pasted in for security reasons (people could steal your passwords).

Once pasted, press enter. You should see the Login button being replaced by a Submit button, as described above. Press it. You should be logged in and be prompted to save the password.

let el = document.querySelector('#un-login-popover button[type=submit]')
el.outerHTML = el.outerHTML.replace('<button', '<input')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment