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
1=== modified file 'plugins/system-update/network/network.cpp'
2--- plugins/system-update/network/network.cpp 2015-08-26 10:06:32 +0000
3+++ plugins/system-update/network/network.cpp 2015-08-26 10:06:32 +0000
4@@ -151,6 +151,11 @@
5
6 int httpStatus = statusAttr.toInt();
7
8+ if (httpStatus == 401 || httpStatus == 403) {
9+ Q_EMIT credentialError();
10+ return;
11+ }
12+
13 if (httpStatus == 200 || httpStatus == 201) {
14 if (reply->hasRawHeader(X_CLICK_TOKEN)) {
15 auto app = qobject_cast<Update*>(reply->request().originatingObject());
16
17=== modified file 'plugins/system-update/network/network.h'
18--- plugins/system-update/network/network.h 2015-08-26 10:06:32 +0000
19+++ plugins/system-update/network/network.h 2015-08-26 10:06:32 +0000
20@@ -61,6 +61,7 @@
21 void networkError();
22 void serverError();
23 void clickTokenObtained(Update *app, const QString &clickToken);
24+ void credentialError();
25
26 private Q_SLOTS:
27 void onReplyFinished();
28
29=== modified file 'plugins/system-update/update_manager.cpp'
30--- plugins/system-update/update_manager.cpp 2015-02-18 19:55:52 +0000
31+++ plugins/system-update/update_manager.cpp 2015-08-26 10:06:32 +0000
32@@ -81,6 +81,8 @@
33 this, SIGNAL(networkError()));
34 QObject::connect(&m_network, SIGNAL(serverError()),
35 this, SIGNAL(serverError()));
36+ QObject::connect(&m_network, SIGNAL(credentialError()),
37+ this, SLOT(handleCredentialsFailed()));
38 QObject::connect(&m_network,
39 SIGNAL(clickTokenObtained(Update*, const QString&)),
40 this, SLOT(clickTokenReceived(Update*, const QString&)));
41@@ -169,6 +171,11 @@
42 m_process.start(command, args);
43 }
44
45+void UpdateManager::handleCredentialsFailed()
46+{
47+ m_service.invalidateCredentials();
48+}
49+
50 QString UpdateManager::getClickCommand()
51 {
52 QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
53
54=== modified file 'plugins/system-update/update_manager.h'
55--- plugins/system-update/update_manager.h 2015-07-13 18:26:10 +0000
56+++ plugins/system-update/update_manager.h 2015-08-26 10:06:32 +0000
57@@ -138,6 +138,7 @@
58 void processUpdates();
59 void downloadApp(Update *app);
60 void handleCredentialsFound(Token token);
61+ void handleCredentialsFailed();
62 void clickTokenReceived(Update *app, const QString &clickToken);
63
64 private:
65
66=== modified file 'tests/plugins/system-update/fakenetwork.h'
67--- tests/plugins/system-update/fakenetwork.h 2014-10-23 13:27:05 +0000
68+++ tests/plugins/system-update/fakenetwork.h 2015-08-26 10:06:32 +0000
69@@ -42,6 +42,7 @@
70 void errorOccurred();
71 void networkError();
72 void serverError();
73+ void credentialError();
74 void downloadUrlFound(const QString& packagename, const QString& url);
75 void clickTokenObtained(Update* app, const QString& clickToken);
76 };
77
78=== modified file 'tests/plugins/system-update/fakessoservice.cpp'
79--- tests/plugins/system-update/fakessoservice.cpp 2015-02-18 19:55:52 +0000
80+++ tests/plugins/system-update/fakessoservice.cpp 2015-08-26 10:06:32 +0000
81@@ -8,6 +8,10 @@
82 {
83 }
84
85+void FakeSsoService::invalidateCredentials()
86+{
87+}
88+
89 void FakeSsoService::getCredentials()
90 {
91 if(m_validCredentials) {
92
93=== modified file 'tests/plugins/system-update/fakessoservice.h'
94--- tests/plugins/system-update/fakessoservice.h 2015-02-18 19:55:52 +0000
95+++ tests/plugins/system-update/fakessoservice.h 2015-08-26 10:06:32 +0000
96@@ -15,6 +15,7 @@
97 explicit FakeSsoService(QObject *parent = 0);
98
99 void getCredentials();
100+ void invalidateCredentials();
101
102 void setValidCredentials(bool value) { m_validCredentials = value; }
103 void setDeletedCredentials(bool value) { m_deletedCredentials = value; }

Subscribers

People subscribed via source and target branches