mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
cf8e87545f
commit
6ea3fd3d92
1 changed files with 12 additions and 9 deletions
|
@ -320,15 +320,18 @@ void QMLManager::saveCloudCredentials()
|
||||||
QRegularExpression regExp("^[a-zA-Z0-9@.+_-]+$");
|
QRegularExpression regExp("^[a-zA-Z0-9@.+_-]+$");
|
||||||
QString cloudPwd = cloudPassword();
|
QString cloudPwd = cloudPassword();
|
||||||
QString cloudUser = cloudUserName();
|
QString cloudUser = cloudUserName();
|
||||||
if (cloudPwd.isEmpty() || !regExp.match(cloudPwd).hasMatch() || !regExp.match(cloudUser).hasMatch()) {
|
if (credentialStatus() != CS_NOCLOUD) {
|
||||||
setStartPageText(RED_FONT + tr("Cloud storage email and password can only consist of letters, numbers, and '.', '-', '_', and '+'.") + END_FONT);
|
// in case of NO_CLOUD, the email address + passwd do not care, so do not check it.
|
||||||
return;
|
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);
|
||||||
// use the same simplistic regex as the backend to check email addresses
|
return;
|
||||||
regExp = QRegularExpression("^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.+_-]+\\.[a-zA-Z0-9]+");
|
}
|
||||||
if (!regExp.match(cloudUser).hasMatch()) {
|
// use the same simplistic regex as the backend to check email addresses
|
||||||
setStartPageText(RED_FONT + tr("Invalid format for email address") + END_FONT);
|
regExp = QRegularExpression("^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.+_-]+\\.[a-zA-Z0-9]+");
|
||||||
return;
|
if (!regExp.match(cloudUser).hasMatch()) {
|
||||||
|
setStartPageText(RED_FONT + tr("Invalid format for email address") + END_FONT);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setOldStatus(credentialStatus());
|
setOldStatus(credentialStatus());
|
||||||
s.beginGroup("CloudStorage");
|
s.beginGroup("CloudStorage");
|
||||||
|
|
Loading…
Reference in a new issue