aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/preferences.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-22 06:24:16 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-22 06:42:35 -0700
commita4168ed5917457a041303a05e4644e8a0fa4294a (patch)
tree5d5266f7669381b11a9a798fc13c580e844376f3 /qt-ui/preferences.cpp
parenta6e9db196f8b04c0e62b1cbd78c85b32b5169f70 (diff)
downloadsubsurface-a4168ed5917457a041303a05e4644e8a0fa4294a.tar.gz
Preferences: don't show error when resetting cloud email / password
Empty values won't work, of course, but they aren't an error, either. Fixes #887 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/preferences.cpp')
-rw-r--r--qt-ui/preferences.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 9d018815b..127320566 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -398,15 +398,17 @@ void PreferencesDialog::syncSettings()
password != prefs.cloud_storage_password) {
// different credentials - reset verification status
prefs.cloud_verification_status = CS_UNKNOWN;
-
- // connect to backend server to check / create credentials
- QRegularExpression reg("^[a-zA-Z0-9@.+_-]+$");
- if (!reg.match(email).hasMatch() || !reg.match(password).hasMatch()) {
- report_error(qPrintable(tr("Cloud storage email and password can only consist of letters, numbers, and '.', '-', '_', and '+'.")));
+ if (!email.isEmpty() && !password.isEmpty()) {
+ // connect to backend server to check / create credentials
+ QRegularExpression reg("^[a-zA-Z0-9@.+_-]+$");
+ if (!reg.match(email).hasMatch() || !password.isEmpty() && !reg.match(password).hasMatch()) {
+ report_error(qPrintable(tr("Cloud storage email and password can only consist of letters, numbers, and '.', '-', '_', and '+'.")));
+ } else {
+ CloudStorageAuthenticate *cloudAuth = new CloudStorageAuthenticate(this);
+ connect(cloudAuth, SIGNAL(finishedAuthenticate()), this, SLOT(cloudPinNeeded()));
+ QNetworkReply *reply = cloudAuth->authenticate(email, password);
+ }
}
- CloudStorageAuthenticate *cloudAuth = new CloudStorageAuthenticate(this);
- connect(cloudAuth, SIGNAL(finishedAuthenticate()), this, SLOT(cloudPinNeeded()));
- QNetworkReply *reply = cloudAuth->authenticate(email, password);
} else if (prefs.cloud_verification_status == CS_NEED_TO_VERIFY) {
QString pin = ui.cloud_storage_pin->text();
if (!pin.isEmpty()) {