Merge lp:~ken-vandine/ubuntu-system-settings/emit_credentials_deleted into lp:ubuntu-system-settings

Proposed by Ken VanDine
Status: Merged
Approved by: Ken VanDine
Approved revision: 1510
Merged at revision: 1517
Proposed branch: lp:~ken-vandine/ubuntu-system-settings/emit_credentials_deleted
Merge into: lp:ubuntu-system-settings
Prerequisite: lp:~mandel/ubuntu-system-settings/correct-nm-usage
Diff against target: 103 lines (+20/-0)
7 files modified
plugins/system-update/network/network.cpp (+5/-0)
plugins/system-update/network/network.h (+1/-0)
plugins/system-update/update_manager.cpp (+7/-0)
plugins/system-update/update_manager.h (+1/-0)
tests/plugins/system-update/fakenetwork.h (+1/-0)
tests/plugins/system-update/fakessoservice.cpp (+4/-0)
tests/plugins/system-update/fakessoservice.h (+1/-0)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-system-settings/emit_credentials_deleted
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Manuel de la Peña (community) Approve
Review via email: mp+268896@code.launchpad.net

Commit message

emit credentialsDeleted when the U1 token expired

Description of the change

emit credentialsDeleted when the U1 token expired

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

invalidateCredentials on credentialError

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Manuel de la Peña (mandel) wrote :

Approving with a small inline comment.

review: Approve
1510. By Ken VanDine

Simplify by calling invalidateCredentials on credentialError instead of adding a new slot

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1511. By Ken VanDine

revert

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/system-update/network/network.cpp'
--- plugins/system-update/network/network.cpp 2015-08-26 10:06:32 +0000
+++ plugins/system-update/network/network.cpp 2015-08-26 10:06:32 +0000
@@ -151,6 +151,11 @@
151151
152 int httpStatus = statusAttr.toInt();152 int httpStatus = statusAttr.toInt();
153153
154 if (httpStatus == 401 || httpStatus == 403) {
155 Q_EMIT credentialError();
156 return;
157 }
158
154 if (httpStatus == 200 || httpStatus == 201) {159 if (httpStatus == 200 || httpStatus == 201) {
155 if (reply->hasRawHeader(X_CLICK_TOKEN)) {160 if (reply->hasRawHeader(X_CLICK_TOKEN)) {
156 auto app = qobject_cast<Update*>(reply->request().originatingObject());161 auto app = qobject_cast<Update*>(reply->request().originatingObject());
157162
=== modified file 'plugins/system-update/network/network.h'
--- plugins/system-update/network/network.h 2015-08-26 10:06:32 +0000
+++ plugins/system-update/network/network.h 2015-08-26 10:06:32 +0000
@@ -61,6 +61,7 @@
61 void networkError();61 void networkError();
62 void serverError();62 void serverError();
63 void clickTokenObtained(Update *app, const QString &clickToken);63 void clickTokenObtained(Update *app, const QString &clickToken);
64 void credentialError();
6465
65private Q_SLOTS:66private Q_SLOTS:
66 void onReplyFinished();67 void onReplyFinished();
6768
=== modified file 'plugins/system-update/update_manager.cpp'
--- plugins/system-update/update_manager.cpp 2015-02-18 19:55:52 +0000
+++ plugins/system-update/update_manager.cpp 2015-08-26 10:06:32 +0000
@@ -81,6 +81,8 @@
81 this, SIGNAL(networkError()));81 this, SIGNAL(networkError()));
82 QObject::connect(&m_network, SIGNAL(serverError()),82 QObject::connect(&m_network, SIGNAL(serverError()),
83 this, SIGNAL(serverError()));83 this, SIGNAL(serverError()));
84 QObject::connect(&m_network, SIGNAL(credentialError()),
85 this, SLOT(handleCredentialsFailed()));
84 QObject::connect(&m_network,86 QObject::connect(&m_network,
85 SIGNAL(clickTokenObtained(Update*, const QString&)),87 SIGNAL(clickTokenObtained(Update*, const QString&)),
86 this, SLOT(clickTokenReceived(Update*, const QString&)));88 this, SLOT(clickTokenReceived(Update*, const QString&)));
@@ -169,6 +171,11 @@
169 m_process.start(command, args);171 m_process.start(command, args);
170}172}
171173
174void UpdateManager::handleCredentialsFailed()
175{
176 m_service.invalidateCredentials();
177}
178
172QString UpdateManager::getClickCommand()179QString UpdateManager::getClickCommand()
173{180{
174 QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();181 QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
175182
=== modified file 'plugins/system-update/update_manager.h'
--- plugins/system-update/update_manager.h 2015-07-13 18:26:10 +0000
+++ plugins/system-update/update_manager.h 2015-08-26 10:06:32 +0000
@@ -138,6 +138,7 @@
138 void processUpdates();138 void processUpdates();
139 void downloadApp(Update *app);139 void downloadApp(Update *app);
140 void handleCredentialsFound(Token token);140 void handleCredentialsFound(Token token);
141 void handleCredentialsFailed();
141 void clickTokenReceived(Update *app, const QString &clickToken);142 void clickTokenReceived(Update *app, const QString &clickToken);
142143
143private:144private:
144145
=== modified file 'tests/plugins/system-update/fakenetwork.h'
--- tests/plugins/system-update/fakenetwork.h 2014-10-23 13:27:05 +0000
+++ tests/plugins/system-update/fakenetwork.h 2015-08-26 10:06:32 +0000
@@ -42,6 +42,7 @@
42 void errorOccurred();42 void errorOccurred();
43 void networkError();43 void networkError();
44 void serverError();44 void serverError();
45 void credentialError();
45 void downloadUrlFound(const QString& packagename, const QString& url);46 void downloadUrlFound(const QString& packagename, const QString& url);
46 void clickTokenObtained(Update* app, const QString& clickToken);47 void clickTokenObtained(Update* app, const QString& clickToken);
47};48};
4849
=== modified file 'tests/plugins/system-update/fakessoservice.cpp'
--- tests/plugins/system-update/fakessoservice.cpp 2015-02-18 19:55:52 +0000
+++ tests/plugins/system-update/fakessoservice.cpp 2015-08-26 10:06:32 +0000
@@ -8,6 +8,10 @@
8{8{
9}9}
1010
11void FakeSsoService::invalidateCredentials()
12{
13}
14
11void FakeSsoService::getCredentials()15void FakeSsoService::getCredentials()
12{16{
13 if(m_validCredentials) {17 if(m_validCredentials) {
1418
=== modified file 'tests/plugins/system-update/fakessoservice.h'
--- tests/plugins/system-update/fakessoservice.h 2015-02-18 19:55:52 +0000
+++ tests/plugins/system-update/fakessoservice.h 2015-08-26 10:06:32 +0000
@@ -15,6 +15,7 @@
15 explicit FakeSsoService(QObject *parent = 0);15 explicit FakeSsoService(QObject *parent = 0);
1616
17 void getCredentials();17 void getCredentials();
18 void invalidateCredentials();
1819
19 void setValidCredentials(bool value) { m_validCredentials = value; }20 void setValidCredentials(bool value) { m_validCredentials = value; }
20 void setDeletedCredentials(bool value) { m_deletedCredentials = value; }21 void setDeletedCredentials(bool value) { m_deletedCredentials = value; }

Subscribers

People subscribed via source and target branches