New client id gen, only filling pw field if user has old client ID

This commit is contained in:
MrFry 2020-04-09 09:20:07 +02:00
parent 5ffcdcaf85
commit 7bccf3c7ee

View file

@ -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
}
}