1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Password observer: Also use 'login' input name as username

This commit is contained in:
David Rosca 2017-05-29 16:15:09 +02:00
parent 57172459d8
commit 74c65c2272

View File

@ -65,12 +65,12 @@ QString Scripts::setupFormObserver()
{
QString source = QL1S("(function() {"
"function findUsername(inputs) {"
" for (var i = 0; i < inputs.length; ++i)"
" if (inputs[i].type == 'text' && inputs[i].value.length && inputs[i].name.indexOf('user') != -1)"
" return inputs[i].value;"
" for (var i = 0; i < inputs.length; ++i)"
" if (inputs[i].type == 'text' && inputs[i].value.length && inputs[i].name.indexOf('name') != -1)"
" return inputs[i].value;"
" var usernameNames = ['user', 'name', 'login'];"
" for (var i = 0; i < usernameNames.length; ++i) {"
" for (var j = 0; j < inputs.length; ++j)"
" if (inputs[j].type == 'text' && inputs[j].value.length && inputs[j].name.indexOf(usernameNames[i]) != -1)"
" return inputs[j].value;"
" }"
" for (var i = 0; i < inputs.length; ++i)"
" if (inputs[i].type == 'text' && inputs[i].value.length)"
" return inputs[i].value;"