From 7bccf3c7ee8fe874df413464f64e8fa73f7b2577 Mon Sep 17 00:00:00 2001 From: MrFry Date: Thu, 9 Apr 2020 09:20:07 +0200 Subject: [PATCH] New client id gen, only filling pw field if user has old client ID --- stable.user.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/stable.user.js b/stable.user.js index 4dbe908..d6b64e9 100755 --- a/stable.user.js +++ b/stable.user.js @@ -21,7 +21,7 @@ // ==UserScript== // @name Moodle/Elearning/KMOOC test help -// @version 2.0.0.7 +// @version 2.0.1.0 // @description Online Moodle/Elearning/KMOOC test help // @author MrFry // @match https://elearning.uni-obuda.hu/main/* @@ -1552,10 +1552,12 @@ const loginButton = document.createElement('button') loginButton.innerText = 'Login' const loginInput = document.createElement('input') - loginInput.type = 'text' + loginInput.type = 'password' loginInput.style.textAlign = 'center' - loginInput.value = getVal('clientId') || '' - + if (getVal('clientId') && getVal('clientId')[0] !== 0) { + loginInput.value = getVal('clientId') || '' + loginInput.type = 'text' + } loginDiv.appendChild(loginInput) loginDiv.appendChild(loginButton) @@ -1668,8 +1670,11 @@ return currId } else { currId = new Date() - currId = currId.getTime() + Math.floor(Math.random() * 10000000) - setVal('clientId', currId.toString()) + currId = currId.getTime() + Math.floor(Math.random() * 1000000000000) + currId = currId.toString().split('') + currId.shift() + currId = '0' + currId.join('') + setVal('clientId', currId) return currId } }