summaryrefslogtreecommitdiffstats
path: root/qt-ui/subsurfacewebservices.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/subsurfacewebservices.cpp')
-rw-r--r--qt-ui/subsurfacewebservices.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index fd9f2fad1..8154ce5fb 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -988,13 +988,17 @@ CloudStorageAuthenticate::CloudStorageAuthenticate(QObject *parent) :
#define CLOUDURL QString(prefs.cloud_base_url)
#define CLOUDBACKENDSTORAGE CLOUDURL + "/storage"
#define CLOUDBACKENDVERIFY CLOUDURL + "/verify"
+#define CLOUDBACKENDUPDATE CLOUDURL + "/update"
-QNetworkReply* CloudStorageAuthenticate::authenticate(QString email, QString password, QString pin)
+QNetworkReply* CloudStorageAuthenticate::backend(QString email, QString password, QString pin, QString newpasswd)
{
QString payload(email + " " + password);
QUrl requestUrl;
- if (pin == "") {
+ if (pin == "" && newpasswd == "") {
requestUrl = QUrl(CLOUDBACKENDSTORAGE);
+ } else if (newpasswd != "") {
+ requestUrl = QUrl(CLOUDBACKENDUPDATE);
+ payload += " " + newpasswd;
} else {
requestUrl = QUrl(CLOUDBACKENDVERIFY);
payload += " " + pin;
@@ -1025,6 +1029,12 @@ void CloudStorageAuthenticate::uploadFinished()
myLastError.clear();
} else if (cloudAuthReply == "[VERIFY]") {
prefs.cloud_verification_status = CS_NEED_TO_VERIFY;
+ } else if (cloudAuthReply == "[PASSWDCHANGED]") {
+ free(prefs.cloud_storage_password);
+ prefs.cloud_storage_password = prefs.cloud_storage_newpassword;
+ prefs.cloud_storage_newpassword = NULL;
+ emit passwordChangeSuccessful();
+ return;
} else {
prefs.cloud_verification_status = CS_INCORRECT_USER_PASSWD;
myLastError = cloudAuthReply;