Merge lp:~mardy/ubuntu-system-settings-online-accounts/handle-errors-1349975 into lp:ubuntu-system-settings-online-accounts

Proposed by Alberto Mardegan
Status: Merged
Approved by: David Barth
Approved revision: 302
Merged at revision: 306
Proposed branch: lp:~mardy/ubuntu-system-settings-online-accounts/handle-errors-1349975
Merge into: lp:ubuntu-system-settings-online-accounts
Diff against target: 208 lines (+81/-10)
8 files modified
debian/control (+2/-2)
online-accounts-ui/browser-request.cpp (+8/-2)
online-accounts-ui/qml/ProviderRequest.qml (+0/-2)
plugins/module/ErrorItem.qml (+48/-0)
plugins/module/OAuth.qml (+20/-2)
plugins/module/WebView.qml (+1/-1)
plugins/module/module.pro (+1/-0)
tests/online-accounts-ui/tst_browser_request.cpp (+1/-1)
To merge this branch: bzr merge lp:~mardy/ubuntu-system-settings-online-accounts/handle-errors-1349975
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Online Accounts Pending
Review via email: mp+272736@code.launchpad.net

Commit message

Retry authentication on network errors

If the authentication fails because of a network error, show an error screen
and let the user retry the authentication from within the plugin.

This requires the BrowserRequest to emit the proper error code, and not cancel
the tiemout failure timer if the current page URL is visited again.

Description of the change

Retry authentication on network errors

If the authentication fails because of a network error, show an error screen
and let the user retry the authentication from within the plugin.

This requires the BrowserRequest to emit the proper error code, and not cancel
the tiemout failure timer if the current page URL is visited again.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
299. By Alberto Mardegan

Expect an error code

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
300. By Alberto Mardegan

Don't stop fail timer on URL change, just restart it.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
301. By Alberto Mardegan

fix build

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
302. By Alberto Mardegan

Layout adjustments

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
303. By Alberto Mardegan

Merge trunk

[ Alberto Mardegan ]
* Regenerate hooks whenever file time changes (LP: #1510640)
[ CI Train Bot ]
* Resync trunk. added: po/hi.po
[ Alberto Mardegan ]
* Simplify hooks, load v2api library added: click-hooks/accounts.cpp
  click-hooks/accounts.hook.in click-hooks/acl-updater.cpp click-
  hooks/acl-updater.h click-hooks/click-hooks.pro click-hooks/online-
  accounts-hooks2.pro online-accounts-
  service/com.ubuntu.OnlineAccounts.Manager.service.in tests/click-
  hooks/click-hooks.pro tests/click-hooks/fake_signond.h tests/click-
  hooks/signond.py tests/click-hooks/tst_online_accounts_hooks2.cpp
  tests/click-hooks/tst_online_accounts_hooks2.pro renamed: click-
  hooks/click-hooks.pro => click-hooks/online-accounts-hooks.pro
  tests/click-hooks/click-hooks.pro => tests/click-
  hooks/tst_online_accounts_hooks.pro
[ CI Train Bot ]
* Resync trunk. added: po/mr.po po/th.po

304. By Alberto Mardegan

merge trunk

[ Alberto Mardegan ]
* Use version 1.3 of Ubuntu.Components (LP: #1508363, #1511055)
[ CI Train Bot ]
* Resync trunk.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2015-10-30 15:41:20 +0000
+++ debian/control 2015-11-02 07:28:58 +0000
@@ -21,7 +21,7 @@
21 qtdeclarative5-qtquick2-plugin,21 qtdeclarative5-qtquick2-plugin,
22 qtdeclarative5-test-plugin,22 qtdeclarative5-test-plugin,
23 qtdeclarative5-ubuntu-ui-toolkit-plugin,23 qtdeclarative5-ubuntu-ui-toolkit-plugin,
24 signon-plugins-dev,24 signon-plugins-dev (>= 8.58),
25 dbus-test-runner,25 dbus-test-runner,
26 xmldiff,26 xmldiff,
27 xvfb,27 xvfb,
@@ -42,7 +42,7 @@
42 libonline-accounts-daemon1,42 libonline-accounts-daemon1,
43 liboxideqt-qmlplugin (>= 1.2.0),43 liboxideqt-qmlplugin (>= 1.2.0),
44 qml-module-ubuntu-onlineaccounts2,44 qml-module-ubuntu-onlineaccounts2,
45 qtdeclarative5-accounts-plugin (>= 0.3),45 qtdeclarative5-accounts-plugin (>= 0.6),
46 qtdeclarative5-ubuntu-ui-toolkit-plugin | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,46 qtdeclarative5-ubuntu-ui-toolkit-plugin | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,
47 signon-ui-service,47 signon-ui-service,
48 ubuntu-system-settings48 ubuntu-system-settings
4949
=== modified file 'online-accounts-ui/browser-request.cpp'
--- online-accounts-ui/browser-request.cpp 2015-04-03 11:37:41 +0000
+++ online-accounts-ui/browser-request.cpp 2015-11-02 07:28:58 +0000
@@ -36,6 +36,7 @@
36#include <QStandardPaths>36#include <QStandardPaths>
37#include <QTimer>37#include <QTimer>
38#include <QVariant>38#include <QVariant>
39#include <SignOn/uisessiondata.h>
39#include <SignOn/uisessiondata_priv.h>40#include <SignOn/uisessiondata_priv.h>
4041
41using namespace SignOnUi;42using namespace SignOnUi;
@@ -179,8 +180,11 @@
179void BrowserRequestPrivate::setCurrentUrl(const QUrl &url)180void BrowserRequestPrivate::setCurrentUrl(const QUrl &url)
180{181{
181 DEBUG() << "Url changed:" << url;182 DEBUG() << "Url changed:" << url;
182 m_failTimer.stop();183 if (m_failTimer.isActive()) {
184 m_failTimer.start();
185 }
183186
187 m_currentUrl = url;
184 if (url.host() == m_finalUrl.host() &&188 if (url.host() == m_finalUrl.host() &&
185 url.path() == m_finalUrl.path()) {189 url.path() == m_finalUrl.path()) {
186 m_responseUrl = url;190 m_responseUrl = url;
@@ -258,7 +262,9 @@
258262
259 DEBUG() << "Page loading failed";263 DEBUG() << "Page loading failed";
260 closeView();264 closeView();
261 q->setResult(QVariantMap());265 QVariantMap result;
266 result[SSOUI_KEY_ERROR] = SignOn::QUERY_ERROR_NETWORK;
267 q->setResult(result);
262}268}
263269
264void BrowserRequestPrivate::onFinished()270void BrowserRequestPrivate::onFinished()
265271
=== modified file 'online-accounts-ui/qml/ProviderRequest.qml'
--- online-accounts-ui/qml/ProviderRequest.qml 2015-10-29 13:44:51 +0000
+++ online-accounts-ui/qml/ProviderRequest.qml 2015-11-02 07:28:58 +0000
@@ -145,8 +145,6 @@
145 Item {145 Item {
146 ActivityIndicator {146 ActivityIndicator {
147 anchors.centerIn: parent147 anchors.centerIn: parent
148 width: units.gu(5)
149 height: width
150 running: true148 running: true
151 }149 }
152 }150 }
153151
=== added file 'plugins/module/ErrorItem.qml'
--- plugins/module/ErrorItem.qml 1970-01-01 00:00:00 +0000
+++ plugins/module/ErrorItem.qml 2015-11-02 07:28:58 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2015 Canonical Ltd.
3 *
4 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 3, as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranties of
12 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13 * PURPOSE. See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.0
20import Ubuntu.Components 0.1
21import Ubuntu.Components.ListItems 0.1 as ListItem
22
23Item {
24 id: root
25
26 signal retryRequested()
27
28 Column {
29 anchors {
30 verticalCenter: parent.verticalCenter
31 left: parent.left; right: parent.right
32 }
33 spacing: units.gu(2)
34
35 Label {
36 anchors { left: parent.left; right: parent.right }
37 text: i18n.dtr("ubuntu-system-settings-online-accounts", "This service is not available right now. Try again later.")
38 wrapMode: Text.WordWrap
39 horizontalAlignment: Text.AlignHCenter
40 }
41
42 Button {
43 anchors.horizontalCenter: parent.horizontalCenter
44 text: i18n.dtr("ubuntu-system-settings-online-accounts", "Try Again")
45 onClicked: root.retryRequested()
46 }
47 }
48}
049
=== modified file 'plugins/module/OAuth.qml'
--- plugins/module/OAuth.qml 2015-10-22 08:33:20 +0000
+++ plugins/module/OAuth.qml 2015-11-02 07:28:58 +0000
@@ -95,7 +95,7 @@
95 }95 }
9696
97 ListItem.Base {97 ListItem.Base {
98 visible: loading98 visible: loading && !errorItem.visible
99 height: units.gu(7)99 height: units.gu(7)
100 showDivider: false100 showDivider: false
101 anchors.top: parent.top101 anchors.top: parent.top
@@ -136,6 +136,16 @@
136 visible: !loading136 visible: !loading
137 }137 }
138138
139 ErrorItem {
140 id: errorItem
141 anchors { fill: parent; margins: units.gu(4) }
142 visible: false
143 onRetryRequested: {
144 root.credentialsStored()
145 visible = false
146 }
147 }
148
139 KeyboardRectangle {149 KeyboardRectangle {
140 id: osk150 id: osk
141 }151 }
@@ -217,7 +227,15 @@
217227
218 onAuthenticated: completeCreation(reply)228 onAuthenticated: completeCreation(reply)
219229
220 onAuthenticationError: root.cancel()230 onAuthenticationError: {
231 console.log("Authentication error, code " + error.code)
232 if (error.code == AccountService.NetworkError) {
233 console.log("Network error")
234 errorItem.visible = true
235 return
236 }
237 root.cancel()
238 }
221239
222 onFinished: loading = false240 onFinished: loading = false
223}241}
224242
=== modified file 'plugins/module/WebView.qml'
--- plugins/module/WebView.qml 2015-10-22 08:28:26 +0000
+++ plugins/module/WebView.qml 2015-11-02 07:28:58 +0000
@@ -14,7 +14,7 @@
1414
15 onLoadingChanged: {15 onLoadingChanged: {
16 console.log("Loading changed")16 console.log("Loading changed")
17 if (loading) {17 if (loading && !lastLoadFailed) {
18 signonRequest.onLoadStarted()18 signonRequest.onLoadStarted()
19 } else if (lastLoadSucceeded) {19 } else if (lastLoadSucceeded) {
20 signonRequest.onLoadFinished(true)20 signonRequest.onLoadFinished(true)
2121
=== modified file 'plugins/module/module.pro'
--- plugins/module/module.pro 2014-10-03 14:56:11 +0000
+++ plugins/module/module.pro 2015-11-02 07:28:58 +0000
@@ -34,6 +34,7 @@
34LIBS += -lonline-accounts-plugin34LIBS += -lonline-accounts-plugin
3535
36QML_SOURCES = \36QML_SOURCES = \
37 ErrorItem.qml \
37 KeyboardRectangle.qml \38 KeyboardRectangle.qml \
38 OAuthMain.qml \39 OAuthMain.qml \
39 OAuth.qml \40 OAuth.qml \
4041
=== modified file 'tests/online-accounts-ui/tst_browser_request.cpp'
--- tests/online-accounts-ui/tst_browser_request.cpp 2015-01-09 10:12:03 +0000
+++ tests/online-accounts-ui/tst_browser_request.cpp 2015-11-02 07:28:58 +0000
@@ -259,7 +259,7 @@
259259
260 QCOMPARE(setResultCalled.count(), 1);260 QCOMPARE(setResultCalled.count(), 1);
261 QVariantMap results = setResultCalled.at(0).at(0).toMap();261 QVariantMap results = setResultCalled.at(0).at(0).toMap();
262 QVERIFY(results.isEmpty());262 QVERIFY(results.contains(SSOUI_KEY_ERROR));
263}263}
264264
265void BrowserRequestTest::testCancelWithHandler()265void BrowserRequestTest::testCancelWithHandler()

Subscribers

People subscribed via source and target branches