1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +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() {" QString source = QL1S("(function() {"
"function findUsername(inputs) {" "function findUsername(inputs) {"
" for (var i = 0; i < inputs.length; ++i)" " var usernameNames = ['user', 'name', 'login'];"
" if (inputs[i].type == 'text' && inputs[i].value.length && inputs[i].name.indexOf('user') != -1)" " for (var i = 0; i < usernameNames.length; ++i) {"
" return inputs[i].value;" " for (var j = 0; j < inputs.length; ++j)"
" for (var i = 0; i < inputs.length; ++i)" " if (inputs[j].type == 'text' && inputs[j].value.length && inputs[j].name.indexOf(usernameNames[i]) != -1)"
" if (inputs[i].type == 'text' && inputs[i].value.length && inputs[i].name.indexOf('name') != -1)" " return inputs[j].value;"
" return inputs[i].value;" " }"
" for (var i = 0; i < inputs.length; ++i)" " for (var i = 0; i < inputs.length; ++i)"
" if (inputs[i].type == 'text' && inputs[i].value.length)" " if (inputs[i].type == 'text' && inputs[i].value.length)"
" return inputs[i].value;" " return inputs[i].value;"