summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-10 06:49:14 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-09-10 16:26:49 -0700
commit2b3f6c607bf5eb7c6b24160832ba83ed60dca543 (patch)
treeba38e074a9fbad112dab25616a804e17e7b248ff /core
parentae653703a5d3ff1da84053d4542420fc70325c5f (diff)
downloadsubsurface-2b3f6c607bf5eb7c6b24160832ba83ed60dca543.tar.gz
prefs: cloud_new_password is not a preference
It's a mamber of the cloud storage authentication class, used to hold the proposed new password until the backend has accepted it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/cloudstorage.cpp5
-rw-r--r--core/cloudstorage.h1
-rw-r--r--core/pref.h1
-rw-r--r--core/settings/qPrefCloudStorage.cpp11
-rw-r--r--core/settings/qPrefCloudStorage.h5
-rw-r--r--core/subsurfacestartup.c1
6 files changed, 4 insertions, 20 deletions
diff --git a/core/cloudstorage.cpp b/core/cloudstorage.cpp
index 51bdf5994..24a536992 100644
--- a/core/cloudstorage.cpp
+++ b/core/cloudstorage.cpp
@@ -26,6 +26,7 @@ QNetworkReply* CloudStorageAuthenticate::backend(const QString& email,const QStr
} else if (!newpasswd.isEmpty()) {
requestUrl = QUrl(CLOUDBACKENDUPDATE);
payload += QChar(' ') + newpasswd;
+ cloudNewPassword = newpasswd;
} else {
requestUrl = QUrl(CLOUDBACKENDVERIFY);
payload += QChar(' ') + pin;
@@ -64,8 +65,8 @@ void CloudStorageAuthenticate::uploadFinished()
report_error(qPrintable(tr("Cloud account verification required, enter PIN in preferences")));
} else if (cloudAuthReply == QLatin1String("[PASSWDCHANGED]")) {
free((void *)prefs.cloud_storage_password);
- prefs.cloud_storage_password = prefs.cloud_storage_newpassword;
- prefs.cloud_storage_newpassword = NULL;
+ prefs.cloud_storage_password = strdup(qPrintable(cloudNewPassword));
+ cloudNewPassword.clear();
emit passwordChangeSuccessful();
return;
} else {
diff --git a/core/cloudstorage.h b/core/cloudstorage.h
index 5ce42a718..681b2b290 100644
--- a/core/cloudstorage.h
+++ b/core/cloudstorage.h
@@ -21,6 +21,7 @@ slots:
private:
QNetworkReply *reply;
QString userAgent;
+ QString cloudNewPassword;
};
QNetworkAccessManager *manager();
diff --git a/core/pref.h b/core/pref.h
index f66a463cc..8b8feb449 100644
--- a/core/pref.h
+++ b/core/pref.h
@@ -91,7 +91,6 @@ struct preferences {
const char *cloud_git_url;
const char *cloud_storage_email;
const char *cloud_storage_email_encoded;
- const char *cloud_storage_newpassword;
const char *cloud_storage_password;
const char *cloud_storage_pin;
short cloud_timeout;
diff --git a/core/settings/qPrefCloudStorage.cpp b/core/settings/qPrefCloudStorage.cpp
index 4576de6fb..ff9ad2553 100644
--- a/core/settings/qPrefCloudStorage.cpp
+++ b/core/settings/qPrefCloudStorage.cpp
@@ -56,17 +56,6 @@ HANDLE_PREFERENCE_TXT(CloudStorage, "email", cloud_storage_email);
HANDLE_PREFERENCE_TXT(CloudStorage, "email_encoded", cloud_storage_email_encoded);
-void qPrefCloudStorage::set_cloud_storage_newpassword(const QString &value)
-{
- if (value == prefs.cloud_storage_newpassword)
- return;
-
- qPrefPrivate::copy_txt(&prefs.cloud_storage_newpassword, value);
-
- // NOT saved on disk, because it is only temporary
- emit instance()->cloud_storage_newpassword_changed(value);
-}
-
void qPrefCloudStorage::set_cloud_storage_password(const QString &value)
{
if (value != prefs.cloud_storage_password) {
diff --git a/core/settings/qPrefCloudStorage.h b/core/settings/qPrefCloudStorage.h
index f9a08372f..751b67675 100644
--- a/core/settings/qPrefCloudStorage.h
+++ b/core/settings/qPrefCloudStorage.h
@@ -11,7 +11,6 @@ class qPrefCloudStorage : public QObject {
Q_PROPERTY(QString cloud_git_url READ cloud_git_url);
Q_PROPERTY(QString cloud_storage_email READ cloud_storage_email WRITE set_cloud_storage_email NOTIFY cloud_storage_email_changed);
Q_PROPERTY(QString cloud_storage_email_encoded READ cloud_storage_email_encoded WRITE set_cloud_storage_email_encoded NOTIFY cloud_storage_email_encoded_changed);
- Q_PROPERTY(QString cloud_storage_newpassword READ cloud_storage_newpassword WRITE set_cloud_storage_newpassword NOTIFY cloud_storage_newpassword_changed);
Q_PROPERTY(QString cloud_storage_password READ cloud_storage_password WRITE set_cloud_storage_password NOTIFY cloud_storage_password_changed);
Q_PROPERTY(QString cloud_storage_pin READ cloud_storage_pin WRITE set_cloud_storage_pin NOTIFY cloud_storage_pin_changed);
Q_PROPERTY(int cloud_verification_status READ cloud_verification_status WRITE set_cloud_verification_status NOTIFY cloud_verification_status_changed);
@@ -34,7 +33,6 @@ public:
static QString cloud_git_url() { return prefs.cloud_git_url; }
static QString cloud_storage_email() { return prefs.cloud_storage_email; }
static QString cloud_storage_email_encoded() { return prefs.cloud_storage_email_encoded; }
- static QString cloud_storage_newpassword() { return prefs.cloud_storage_newpassword; }
static QString cloud_storage_password() { return prefs.cloud_storage_password; }
static QString cloud_storage_pin() { return prefs.cloud_storage_pin; }
static int cloud_timeout() { return prefs.cloud_timeout; }
@@ -47,7 +45,6 @@ public slots:
static void set_cloud_base_url(const QString &value);
static void set_cloud_storage_email(const QString &value);
static void set_cloud_storage_email_encoded(const QString &value);
- static void set_cloud_storage_newpassword(const QString &value);
static void set_cloud_storage_password(const QString &value);
static void set_cloud_storage_pin(const QString &value);
static void set_cloud_timeout(int value);
@@ -60,7 +57,6 @@ signals:
void cloud_base_url_changed(const QString &value);
void cloud_storage_email_changed(const QString &value);
void cloud_storage_email_encoded_changed(const QString &value);
- void cloud_storage_newpassword_changed(const QString &value);
void cloud_storage_password_changed(const QString &value);
void cloud_storage_pin_changed(const QString &value);
void cloud_timeout_changed(int value);
@@ -74,7 +70,6 @@ private:
static void disk_cloud_base_url(bool doSync);
static void disk_cloud_storage_email(bool doSync);
static void disk_cloud_storage_email_encoded(bool doSync);
- static void disk_cloud_storage_newpassword(bool doSync);
static void disk_cloud_storage_password(bool doSync);
static void disk_cloud_storage_pin(bool doSync);
static void disk_cloud_timeout(bool doSync);
diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c
index 7e7ba0c9e..6e52b5156 100644
--- a/core/subsurfacestartup.c
+++ b/core/subsurfacestartup.c
@@ -307,7 +307,6 @@ void copy_prefs(struct preferences *src, struct preferences *dest)
dest->date_format = copy_string(src->date_format);
dest->date_format_short = copy_string(src->date_format_short);
dest->cloud_storage_password = copy_string(src->cloud_storage_password);
- dest->cloud_storage_newpassword = copy_string(src->cloud_storage_newpassword);
dest->cloud_storage_email = copy_string(src->cloud_storage_email);
dest->cloud_storage_email_encoded = copy_string(src->cloud_storage_email_encoded);
dest->facebook.access_token = copy_string(src->facebook.access_token);