From b88bfd46c78f06765aaf8ccc59c7a6d7d053a994 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sun, 20 Nov 2011 17:09:10 +0100 Subject: [PATCH] Password manager now detects also username - username is detected as first input type="text" in form - it should work on almost every page This is last requirements to implement saving multiple users on one page. --- bin/locale/cs_CZ.qm | Bin 82852 -> 82958 bytes src/autofill/autofillmodel.cpp | 95 ++++++++++++++---- src/autofill/autofillmodel.h | 9 +- src/autofill/autofillnotification.cpp | 7 +- src/autofill/autofillnotification.h | 3 +- .../desktopnotificationsfactory.cpp | 36 +++---- src/preferences/autofillmanager.cpp | 12 +-- src/preferences/autofillmanager.ui | 18 +++- translations/cs_CZ.ts | 31 +++--- translations/de_DE.ts | 31 +++--- translations/es.ts | 31 +++--- translations/it_IT.ts | 31 +++--- translations/nl_NL.ts | 31 +++--- translations/sk_SK.ts | 31 +++--- translations/zh_CN.ts | 31 +++--- 15 files changed, 254 insertions(+), 143 deletions(-) diff --git a/bin/locale/cs_CZ.qm b/bin/locale/cs_CZ.qm index f06ef23178a3c8ada492e9ea2c535c16c8668d47..0392bf58bd9eb9a3e706cddc0769d35de2d71d81 100644 GIT binary patch delta 6599 zcmX|`d0b8T|Ht3w-gC~q_uO;uP1%Y`tDz`^W-N(>NRmX9k`gkqB>Ql)jV(*EwM;@P zNsKfo(n^IaQQ0EPV1|&g4f($6{2sqQJf8O)XZd{I@7H@fC2!!iZRB>e)%PNzpNLlO zCgSpmcpn^UaXg2}HJND1Nr`_m5?^#78rg%$$&ARYm>7N~(fFA})&0OtL?MfbeAW{6 z`<=*l2{FttqA5{C=7kb%w@3_jC0Tkgk;&O)VmHJSg(-+lS%wFWAU5p)QKf(Mu@3r; z#OAU%`GVN%*2E}JfWyE#V(;uAitkVCn;N29Zp40YAew7PT<88o(`&)uSd9^J?oWv7 z?7&7M(-p*p-o|x9h}&|U7}Yl7qFAERLgMz75IKYrmtak#N(HfU{kQMv^kQjUOpy9GlqVg=|$B2fNd}g=yMHq`?oJqv>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rp+t)}-z#G*4*85QKH9qF}Szs(f&rVYUuqQQoR= zw$7bF7alM#Y)f@;>9Tp*fwR=YiRP6hO?igqXkJ&B3)no|yoI|8ELdjV_5&C2HPO7| z)Ffc_aC6!n9(`FaC?EbT zs-j>KEb>tf=hkTogWD?1?WpiS!D7?r4EI}Emb&N0aY0uUPF`%OSMr42=c&c%7ltbI zU=;Ow&BruL^n@1N#Q$fBzQy`? zd9ToYpTd^I6`p=-nQh1N-toi|QyPN7*tyWMXN8)s?rAyQ-V=BnX~|AHK-Vp|Tp!hk zVm;h)qn9lNm#&s4TWPuD2Fr_YZ+J3PVR>_cqTU>5`8?E@joi=j#g4I$=^p{X%|G48 uZi=lC5?|gp(BjJfp>*WYEHjdS&Ew}aag)Z6tMB^rf~+RTvYH6Kwf+y`4Z)BA diff --git a/src/autofill/autofillmodel.cpp b/src/autofill/autofillmodel.cpp index f0ec3b225..6f8693b37 100644 --- a/src/autofill/autofillmodel.cpp +++ b/src/autofill/autofillmodel.cpp @@ -110,7 +110,7 @@ bool AutoFillModel::addEntry(const QUrl &url, const QString &name, const QString } ///WEB Form -bool AutoFillModel::addEntry(const QUrl &url, const QByteArray &data, const QString &pass) +bool AutoFillModel::addEntry(const QUrl &url, const QByteArray &data, const QString &user, const QString &pass) { QSqlQuery query; query.exec("SELECT data FROM autofill WHERE server='" + url.host() + "'"); @@ -118,10 +118,11 @@ bool AutoFillModel::addEntry(const QUrl &url, const QByteArray &data, const QStr return false; } - query.prepare("INSERT INTO autofill (server, data, password) VALUES (?,?,?)"); + query.prepare("INSERT INTO autofill (server, data, username, password) VALUES (?,?,?,?)"); query.bindValue(0, url.host()); query.bindValue(1, data); - query.bindValue(2, pass); + query.bindValue(2, user); + query.bindValue(3, pass); return query.exec(); } @@ -192,37 +193,95 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo return; } - QString passwordName = ""; - QString passwordValue = ""; + QString usernameName; + QString usernameValue; + QString passwordName; + QString passwordValue; QUrl siteUrl = webView->url(); - QWebElementCollection inputs; + if (!isStoringEnabled(siteUrl)) { + return; + } + + QWebElementCollection allForms; // All form elements on page + QWebElement foundForm; // Sent form element + QList frames; - frames.append(webPage->mainFrame()); + frames.append(webPage->mainFrame()); // Find all form elements while (!frames.isEmpty()) { QWebFrame* frame = frames.takeFirst(); - inputs.append(frame->findAllElements("input[type=\"password\"]")); + allForms.append(frame->findAllElements("form")); frames += frame->childFrames(); } - foreach(QWebElement element, inputs) { - passwordName = element.attribute("name"); - passwordValue = element.evaluateJavaScript("this.value").toString(); - if (!passwordValue.isEmpty()) { + foreach(QWebElement formElement, allForms) { + foreach(QWebElement inputElement, formElement.findAll("input[type=\"password\"]")) { + passwordName = inputElement.attribute("name"); + passwordValue = getValueFromData(outgoingData, inputElement); + + if (!passwordValue.isEmpty() && dataContains(outgoingData, passwordName)) { + foundForm = formElement; + break; + } + } + + if (!foundForm.isNull()) { break; } } - //Return if storing is not enabled, data for this page is already stored, no password element found in sent data - if (passwordName.isEmpty() || !isStoringEnabled(siteUrl) || isStored(siteUrl)) { + // Return if data for this page is already stored or no password element found in sent data + if (foundForm.isNull() || isStored(siteUrl)) { return; } - //Return if no password form has been sent - if (!outgoingData.contains((QUrl(passwordName).toEncoded() + "=")) || passwordValue.isEmpty()) { - return; + // We need to find username, we suppose that username is first not empty input[type=text] in form + // Tell me better solution. Maybe first try to find name="user", name="username" ? + + foreach(QWebElement element, foundForm.findAll("input[type=\"text\"]")) { + usernameName = element.attribute("name"); + usernameValue = getValueFromData(outgoingData, element); + if (!usernameName.isEmpty() && !usernameValue.isEmpty()) { + break; + } } - AutoFillNotification* aWidget = new AutoFillNotification(siteUrl, outgoingData, passwordValue); + AutoFillNotification* aWidget = new AutoFillNotification(siteUrl, outgoingData, usernameValue, passwordValue); webView->addNotification(aWidget); } + +QString AutoFillModel::getValueFromData(const QByteArray &data, QWebElement element) +{ + QString name = element.attribute("name"); + if (name.isEmpty()) { + return ""; + } + + QString value = element.evaluateJavaScript("this.value").toString(); + if (value.isEmpty()) { + QueryItems queryItems = QUrl("http://a.b/?" + data).queryItems(); + for (int i = 0; i < queryItems.count(); i++) { + QueryItem item = queryItems.at(i); + + if (item.first == name) { + value = item.second; + } + } + } + + return value; +} + +bool AutoFillModel::dataContains(const QByteArray &data, const QString &attributeName) +{ + QueryItems queryItems = QUrl("http://a.b/?" + data).queryItems(); + for (int i = 0; i < queryItems.count(); i++) { + QueryItem item = queryItems.at(i); + + if (item.first == attributeName) { + return !item.second.isEmpty(); + } + } + + return false; +} diff --git a/src/autofill/autofillmodel.h b/src/autofill/autofillmodel.h index 077c442f8..2a4ef7958 100644 --- a/src/autofill/autofillmodel.h +++ b/src/autofill/autofillmodel.h @@ -21,6 +21,7 @@ #include #include #include +#include class QupZilla; class WebView; @@ -28,6 +29,9 @@ class AutoFillModel : public QObject { Q_OBJECT public: + typedef QList > QueryItems; + typedef QPair QueryItem; + explicit AutoFillModel(QupZilla* mainClass, QObject* parent = 0); void completePage(WebView* view); @@ -38,7 +42,7 @@ public: QString getUsername(const QUrl &url); QString getPassword(const QUrl &url); bool addEntry(const QUrl &url, const QString &name, const QString &pass); - bool addEntry(const QUrl &url, const QByteArray &data, const QString &pass); + bool addEntry(const QUrl &url, const QByteArray &data, const QString &user, const QString &pass); void post(const QNetworkRequest &request, const QByteArray &outgoingData); @@ -48,6 +52,9 @@ public slots: void loadSettings(); private: + bool dataContains(const QByteArray &data, const QString &attributeName); + QString getValueFromData(const QByteArray &data, QWebElement element); + QupZilla* p_QupZilla; QByteArray m_lastOutgoingData; bool m_isStoring; diff --git a/src/autofill/autofillnotification.cpp b/src/autofill/autofillnotification.cpp index 355de1ef7..0f7eb5c20 100644 --- a/src/autofill/autofillnotification.cpp +++ b/src/autofill/autofillnotification.cpp @@ -22,16 +22,17 @@ #include "animatedwidget.h" #include "iconprovider.h" -AutoFillNotification::AutoFillNotification(QUrl url, QByteArray data, QString pass, QWidget* parent) +AutoFillNotification::AutoFillNotification(const QUrl &url, const QByteArray &data, const QString &user, const QString &pass, QWidget* parent) : AnimatedWidget(AnimatedWidget::Down, 300, parent) , ui(new Ui::AutoFillWidget) , m_url(url) , m_data(data) + , m_user(user) , m_pass(pass) { setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(widget()); - ui->label->setText(tr("Do you want QupZilla to remember password on %1?").arg(url.host())); + ui->label->setText(tr("Do you want QupZilla to remember password for %1 on %2?").arg(user, url.host())); ui->closeButton->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton)); connect(ui->remember, SIGNAL(clicked()), this, SLOT(remember())); @@ -50,7 +51,7 @@ void AutoFillNotification::never() void AutoFillNotification::remember() { - mApp->autoFill()->addEntry(m_url, m_data, m_pass); + mApp->autoFill()->addEntry(m_url, m_data, m_user, m_pass); hide(); } diff --git a/src/autofill/autofillnotification.h b/src/autofill/autofillnotification.h index edd3a47f0..38b5f1810 100644 --- a/src/autofill/autofillnotification.h +++ b/src/autofill/autofillnotification.h @@ -35,7 +35,7 @@ class AutoFillNotification : public AnimatedWidget Q_OBJECT public: - explicit AutoFillNotification(QUrl url, QByteArray data, QString pass, QWidget* parent = 0); + explicit AutoFillNotification(const QUrl &url, const QByteArray &data, const QString &user, const QString &pass, QWidget* parent = 0); ~AutoFillNotification(); private slots: @@ -46,6 +46,7 @@ private: Ui::AutoFillWidget* ui; QUrl m_url; QByteArray m_data; + QString m_user; QString m_pass; }; diff --git a/src/desktopnotifications/desktopnotificationsfactory.cpp b/src/desktopnotifications/desktopnotificationsfactory.cpp index 2460829f7..9f81df3c2 100644 --- a/src/desktopnotifications/desktopnotificationsfactory.cpp +++ b/src/desktopnotifications/desktopnotificationsfactory.cpp @@ -88,24 +88,24 @@ void DesktopNotificationsFactory::notify(const QPixmap &icon, const QString &hea void DesktopNotificationsFactory::nativeNotificationPreview() { #ifdef Q_WS_X11 - QFile tmp(QDir::tempPath() + "/qupzilla_notif.png"); - tmp.open(QFile::WriteOnly); - QPixmap(":icons/preferences/stock_dialog-question.png").save(tmp.fileName()); + QFile tmp(QDir::tempPath() + "/qupzilla_notif.png"); + tmp.open(QFile::WriteOnly); + QPixmap(":icons/preferences/stock_dialog-question.png").save(tmp.fileName()); - QDBusInterface dbus("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", QDBusConnection::sessionBus()); - QVariantList args; - args.append("qupzilla"); - args.append(m_uint); - args.append(tmp.fileName()); - args.append(tr("Native System Notification")); - args.append(""); - args.append(QStringList()); - args.append(QVariantMap()); - args.append(m_timeout); - QDBusMessage message = dbus.callWithArgumentList(QDBus::Block, "Notify", args); - QVariantList list = message.arguments(); - if (list.count() > 0) { - m_uint = list.at(0).toInt(); - } + QDBusInterface dbus("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", QDBusConnection::sessionBus()); + QVariantList args; + args.append("qupzilla"); + args.append(m_uint); + args.append(tmp.fileName()); + args.append(tr("Native System Notification")); + args.append(""); + args.append(QStringList()); + args.append(QVariantMap()); + args.append(m_timeout); + QDBusMessage message = dbus.callWithArgumentList(QDBus::Block, "Notify", args); + QVariantList list = message.arguments(); + if (list.count() > 0) { + m_uint = list.at(0).toInt(); + } #endif } diff --git a/src/preferences/autofillmanager.cpp b/src/preferences/autofillmanager.cpp index 81f453b59..61e1f8f6b 100644 --- a/src/preferences/autofillmanager.cpp +++ b/src/preferences/autofillmanager.cpp @@ -39,15 +39,15 @@ AutoFillManager::AutoFillManager(QWidget* parent) void AutoFillManager::loadPasswords() { QSqlQuery query; - query.exec("SELECT server, password, id FROM autofill"); + query.exec("SELECT server, username, password, id FROM autofill"); ui->treePass->clear(); while (query.next()) { QTreeWidgetItem* item = new QTreeWidgetItem(ui->treePass); item->setText(0, query.value(0).toString()); -// item->setText(1, query.value(1).toString()); - item->setText(1, "*****"); - item->setWhatsThis(0, query.value(2).toString()); - item->setWhatsThis(1, query.value(1).toString()); + item->setText(1, query.value(1).toString()); + item->setText(2, "*****"); + item->setWhatsThis(0, query.value(3).toString()); + item->setWhatsThis(1, query.value(2).toString()); ui->treePass->addTopLevelItem(item); } @@ -79,7 +79,7 @@ void AutoFillManager::showPasswords() if (!item) { continue; } - item->setText(1, item->whatsThis(1)); + item->setText(2, item->whatsThis(1)); } ui->showPasswords->hide(); diff --git a/src/preferences/autofillmanager.ui b/src/preferences/autofillmanager.ui index d4367db31..65d581bb4 100644 --- a/src/preferences/autofillmanager.ui +++ b/src/preferences/autofillmanager.ui @@ -29,14 +29,22 @@ + + 0 + - 170 + 100 Server + + + Username + + Password @@ -47,16 +55,16 @@ - + - Remove + Edit - + - Edit + Remove diff --git a/translations/cs_CZ.ts b/translations/cs_CZ.ts index dccad00c4..ea11abdb9 100644 --- a/translations/cs_CZ.ts +++ b/translations/cs_CZ.ts @@ -228,41 +228,46 @@ Hesla - - + + Server Server - + + Username + Uživatel + + + Password Heslo - - + + Remove Odstranit - + Edit Upravit - - + + Remove All Odstranit vše - + Show Passwords Zobrazit hesla - + Exceptions Vyjímky @@ -295,9 +300,9 @@ AutoFillNotification - - Do you want QupZilla to remember password on %1? - Chcete aby si QupZilla zapamatovala heslo pro %1? + + Do you want QupZilla to remember password for <b>%1</b> on %2? + Chcete aby si QupZilla zapamatovala heslo pro <b>%1<b> na %2? diff --git a/translations/de_DE.ts b/translations/de_DE.ts index 76d96df2d..b1adf1d83 100644 --- a/translations/de_DE.ts +++ b/translations/de_DE.ts @@ -228,41 +228,46 @@ Passwörter - - + + Server Server - + + Username + + + + Password Passwort - - + + Remove Entfernen - + Edit Bearbeiten - - + + Remove All Alle entfernen - + Show Passwords Passwörter im Klartext anzeigen - + Exceptions Ausnahmen @@ -295,9 +300,9 @@ AutoFillNotification - - Do you want QupZilla to remember password on %1? - Möchten Sie das Passwort für %1 speichern? + + Do you want QupZilla to remember password for <b>%1</b> on %2? + diff --git a/translations/es.ts b/translations/es.ts index 0792df9f0..b774f94f4 100644 --- a/translations/es.ts +++ b/translations/es.ts @@ -228,41 +228,46 @@ Contraseñas - - + + Server Servidor - + + Username + + + + Password Contraseña - - + + Remove Quitar - + Edit Editar - - + + Remove All Quitar todo - + Show Passwords Mostras contraseñas - + Exceptions Excepciones @@ -295,9 +300,9 @@ AutoFillNotification - - Do you want QupZilla to remember password on %1? - ¿Desea que QupZilla recuerde la contraseña en %1? + + Do you want QupZilla to remember password for <b>%1</b> on %2? + diff --git a/translations/it_IT.ts b/translations/it_IT.ts index 364395f93..072a1d261 100644 --- a/translations/it_IT.ts +++ b/translations/it_IT.ts @@ -228,41 +228,46 @@ Passwords - - + + Server Server - + + Username + + + + Password Password - - + + Remove Elimina - + Edit Modifica - - + + Remove All Elimina Tutto - + Show Passwords Mostra le password - + Exceptions Eccezioni @@ -295,9 +300,9 @@ AutoFillNotification - - Do you want QupZilla to remember password on %1? - Vuoi che QupZilla ricordi la password per %1? + + Do you want QupZilla to remember password for <b>%1</b> on %2? + diff --git a/translations/nl_NL.ts b/translations/nl_NL.ts index ebba89eeb..d7dc32eba 100644 --- a/translations/nl_NL.ts +++ b/translations/nl_NL.ts @@ -228,41 +228,46 @@ Wachtwoorden - - + + Server Server - + + Username + + + + Password Wachtwoord - - + + Remove Verwijder - + Edit Bewerk - - + + Remove All Verwijder alles - + Show Passwords Toon wachtwoorden - + Exceptions Uitzonderingen @@ -295,9 +300,9 @@ AutoFillNotification - - Do you want QupZilla to remember password on %1? - Wilt u dat QupZilla uw wachtwoord onthoudt voor %1? + + Do you want QupZilla to remember password for <b>%1</b> on %2? + diff --git a/translations/sk_SK.ts b/translations/sk_SK.ts index b14e94779..05681bab7 100644 --- a/translations/sk_SK.ts +++ b/translations/sk_SK.ts @@ -228,41 +228,46 @@ Heslá - - + + Server Server - + + Username + + + + Password Heslo - - + + Remove Odstrániť - + Edit Upraviť - - + + Remove All Odstrániť všetko - + Show Passwords Zobraziť heslo - + Exceptions Výnimky @@ -295,9 +300,9 @@ AutoFillNotification - - Do you want QupZilla to remember password on %1? - Chcete aby si QupZilla zapamätala heslo pre %1? + + Do you want QupZilla to remember password for <b>%1</b> on %2? + diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 1b7007423..f266c7f92 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -228,41 +228,46 @@ 密码 - - + + Server 服务器 - + + Username + + + + Password 密码 - - + + Remove 删除 - + Edit 编辑 - - + + Remove All 全部删除 - + Show Passwords 显示密码 - + Exceptions 例外 @@ -295,9 +300,9 @@ AutoFillNotification - - Do you want QupZilla to remember password on %1? - 需要QupZilla记住%1密码? + + Do you want QupZilla to remember password for <b>%1</b> on %2? +