summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-23 12:08:38 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-25 08:36:01 -0700
commit9deb4f4a22f69c1434b8d175868cf3b9446bf808 (patch)
tree69bfc23b20dcbec50894d998debc5dfac97cf7d6
parent891c0e7ec666c97255476260f8058e5bac3b80f8 (diff)
downloadsubsurface-9deb4f4a22f69c1434b8d175868cf3b9446bf808.tar.gz
mobile/credentials: email address must be lower case
I could have sworn that I have fixed this several times in various places, but apparently (as shown by todays support emails) it's still possible to setup a mixed case email address. So let's try to solve this problem at the very top. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--CHANGELOG.md1
-rw-r--r--mobile-widgets/qmlmanager.cpp13
2 files changed, 9 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c93b167ab..becc3879d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
+Mobile: convert entered email to lower case
desktop: localize salinity string with respect to thousands separators
desktop: update date and time fields on maintab if user changes preferences
mobile: small improvements to usability with dark theme
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 82cc5309b..b56be67aa 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -558,24 +558,27 @@ void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &ne
bool cloudCredentialsChanged = false;
bool noCloud = qPrefCloudStorage::cloud_verification_status() == qPrefCloudStorage::CS_NOCLOUD;
+ // email address MUST be lower case or bad things happen
+ QString email = newEmail.toLower();
+
// make sure we only have letters, numbers, and +-_. in password and email address
QRegularExpression regExp("^[a-zA-Z0-9@.+_-]+$");
if (!noCloud) {
// in case of NO_CLOUD, the email address + passwd do not care, so do not check it.
if (newPassword.isEmpty() ||
!regExp.match(newPassword).hasMatch() ||
- !regExp.match(newEmail).hasMatch()) {
+ !regExp.match(email).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(newEmail).hasMatch()) {
+ if (!regExp.match(email).hasMatch()) {
setStartPageText(RED_FONT + tr("Invalid format for email address") + END_FONT);
return;
}
}
- if (!same_string(prefs.cloud_storage_email, qPrintable(newEmail))) {
+ if (!same_string(prefs.cloud_storage_email, qPrintable(email))) {
cloudCredentialsChanged = true;
}
@@ -589,11 +592,11 @@ void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &ne
qPrefCloudStorage::set_cloud_verification_status(m_oldStatus);
}
- if (!noCloud && !verifyCredentials(newEmail, newPassword, pin)) {
+ if (!noCloud && !verifyCredentials(email, newPassword, pin)) {
appendTextToLog("saveCloudCredentials: given cloud credentials didn't verify");
return;
}
- qPrefCloudStorage::set_cloud_storage_email(newEmail);
+ qPrefCloudStorage::set_cloud_storage_email(email);
qPrefCloudStorage::set_cloud_storage_password(newPassword);
if (m_oldStatus == qPrefCloudStorage::CS_NOCLOUD && cloudCredentialsChanged && dive_table.nr) {