diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-14 13:50:13 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-14 14:06:28 -0700 |
commit | b5eb66545b4c28809610d0778b9a797da9dda002 (patch) | |
tree | efd7b4c175a7dc5f3454078fe668b85baecf1d6e /qt-ui/subsurfacewebservices.cpp | |
parent | 8f7a4a1a97629f29e054a9a2204bfffa558e1121 (diff) | |
download | subsurface-b5eb66545b4c28809610d0778b9a797da9dda002.tar.gz |
Cloud storage: clean up handling of cloud storage account
Correctly tracking the status of our authentication with the cloud service
is non-trivial, especially since the user may quit Subsurface between
registering and verifying an account, they might even register on one
machine and verify on another.
This tries to make sure that when in doubt we check with the cloud service
backend. And we show errors in the UI.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/subsurfacewebservices.cpp')
-rw-r--r-- | qt-ui/subsurfacewebservices.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index 16faac61d..06e4d1ec2 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -976,12 +976,16 @@ void CloudStorageAuthenticate::uploadFinished() { QString cloudAuthReply(reply->readAll()); qDebug() << "Completed connection with cloud storage backend, response" << cloudAuthReply; - if (cloudAuthReply == "[VERIFIED]") { - prefs.show_cloud_pin = false; - emit finishedAuthenticate(prefs.show_cloud_pin); + if (cloudAuthReply == "[VERIFIED]" || cloudAuthReply == "[OK]") { + prefs.cloud_verification_status = CS_VERIFIED; + emit finishedAuthenticate(); } else if (cloudAuthReply == "[VERIFY]") { - prefs.show_cloud_pin = true; - emit finishedAuthenticate(prefs.show_cloud_pin); + prefs.cloud_verification_status = CS_NEED_TO_VERIFY; + emit finishedAuthenticate(); + } else { + prefs.cloud_verification_status = CS_INCORRECT_USER_PASSWD; + report_error("%s", qPrintable(cloudAuthReply)); + MainWindow::instance()->getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error); } } |