Created
September 4, 2022 20:08
-
-
Save BananaAcid/60923eee3567a06fa0a7b7661023a59a to your computer and use it in GitHub Desktop.
remember username + fix/remove spaces in inserted 2FA key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name schule.hessen.de - Fixes | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Remember User name, and fix spacings in inserted one-time-passwords (copied from Authy) | |
// @author Nabil Redmann | |
// @match https://owa.hessen.de/logon/LogonPoint/tmindex.html | |
// @icon https://www.google.com/s2/favicons?domain=hessen.de | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// prefill username, if stored | |
let i = setInterval(function() { | |
let el = document.querySelector('#login'); | |
if (el) { | |
el.value = localStorage.user || ''; | |
clearInterval(i); | |
}; | |
}, 300); | |
// update username | |
let saveUser = function(ev) { | |
if (ev.target.id == 'login') { | |
console.log('user changed:', ev.target.value); | |
localStorage.user = ev.target.value; | |
} | |
} | |
document.addEventListener('keyup', saveUser); | |
document.addEventListener('change', saveUser); | |
// remove spaces from inserted one-time-passwords | |
let fixAuthy = function(ev) { | |
console.log(ev); | |
if (ev.target.id === 'passwd') { | |
ev.stopPropagation(); | |
console.log('passwd', ev.target, ev.target.value); | |
ev.target.value = ev.target.value.replaceAll(' ', ''); | |
} | |
}; | |
document.addEventListener('keyup', fixAuthy); | |
document.addEventListener('change', fixAuthy); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment