blob: 0fb6dac57a2c9066765ef8fe2b6221e17b82d4b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
Index: a/libkgoogle/authdialog.cpp
===================================================================
--- a/libkgoogle/authdialog.cpp
+++ b/libkgoogle/authdialog.cpp 2012-06-10 07:59:32.053613556 -0300
@@ -102,13 +102,19 @@
}
if (url.host() == "accounts.google.com" && url.path() == "/o/oauth2/approval") {
- QWebElement el = m_webiew->page()->mainFrame()->findFirstElement("textarea");
- if (el.isNull()) {
+ QString title = m_webiew->title();
+ QString token;
+
+
+ if (title.startsWith(QLatin1String("success"), Qt::CaseInsensitive)) {
+ int pos = title.indexOf(QLatin1String("code="));
+ /* Skip the 'code=' string as well */
+ token = title.mid (pos + 5);
+ } else {
emitError(KGoogle::AuthError, i18n("Parsing token page failed."));
return;
}
- QString token = el.toInnerXml();
if (token.isEmpty()) {
emitError(KGoogle::AuthError, i18n("Failed to obtain token."));
return;
@@ -292,4 +298,4 @@
{
m_username = QString();
m_password = QString();
-}
\ Pas de fin de ligne à la fin du fichier
+}
|