diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2017-09-27 18:19:53 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-09-29 08:13:25 -0700 |
commit | 6ea3fd3d92fdfeeaed64315ed31bb8e97c107f6b (patch) | |
tree | efe050260fbc27ec5be72ef790eddec8dcd8b83f | |
parent | cf8e87545f1e2bfb2d995e6ad9bbd348589293c6 (diff) | |
download | subsurface-6ea3fd3d92fdfeeaed64315ed31bb8e97c107f6b.tar.gz |
mobile: do not care about email/passwd when NOCLOUD
In case the credential state is NOCLOUD, the saving of credentials
in the preferences was suppressed in case of invalid data in the
email/passwd fields.
There is no reason to check these fields for correct input, as they
are not used in case of NOCLOUD mode. A simple if statement is added.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 3961cc5cf..6292f95fe 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -320,15 +320,18 @@ void QMLManager::saveCloudCredentials() QRegularExpression regExp("^[a-zA-Z0-9@.+_-]+$"); QString cloudPwd = cloudPassword(); QString cloudUser = cloudUserName(); - if (cloudPwd.isEmpty() || !regExp.match(cloudPwd).hasMatch() || !regExp.match(cloudUser).hasMatch()) { - setStartPageText(RED_FONT + tr("Cloud storage email and password can only consist of letters, numbers, and '.', '-', '_', and '+'.") + END_FONT); - return; - } - // use the same simplistic regex as the backend to check email addresses - regExp = QRegularExpression("^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.+_-]+\\.[a-zA-Z0-9]+"); - if (!regExp.match(cloudUser).hasMatch()) { - setStartPageText(RED_FONT + tr("Invalid format for email address") + END_FONT); - return; + if (credentialStatus() != CS_NOCLOUD) { + // in case of NO_CLOUD, the email address + passwd do not care, so do not check it. + if (cloudPwd.isEmpty() || !regExp.match(cloudPwd).hasMatch() || !regExp.match(cloudUser).hasMatch()) { + setStartPageText(RED_FONT + tr("Cloud storage email and password can only consist of letters, numbers, and '.', '-', '_', and '+'.") + END_FONT); + return; + } + // use the same simplistic regex as the backend to check email addresses + regExp = QRegularExpression("^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.+_-]+\\.[a-zA-Z0-9]+"); + if (!regExp.match(cloudUser).hasMatch()) { + setStartPageText(RED_FONT + tr("Invalid format for email address") + END_FONT); + return; + } } setOldStatus(credentialStatus()); s.beginGroup("CloudStorage"); |