mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile-widgets: make saveCredentials() an atom
Call saveCredentials with username/password to avoid first setting the two and then calling. Change saveCredentials() to use newUser, newPassword. Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
parent
e92dbe7974
commit
9117aa2a52
3 changed files with 7 additions and 6 deletions
|
@ -458,7 +458,7 @@ void QMLManager::finishSetup()
|
|||
} else if (!empty_string(existing_filename) &&
|
||||
QMLPrefs::instance()->credentialStatus() != qPrefCloudStorage::CS_UNKNOWN) {
|
||||
QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_NOCLOUD);
|
||||
saveCloudCredentials();
|
||||
saveCloudCredentials(qPrefCloudStorage::cloud_storage_email(), qPrefCloudStorage::cloud_storage_password());
|
||||
appendTextToLog(tr("working in no-cloud mode"));
|
||||
int error = parse_file(existing_filename, &dive_table, &trip_table, &dive_site_table);
|
||||
if (error) {
|
||||
|
@ -494,11 +494,14 @@ QMLManager *QMLManager::instance()
|
|||
#define CLOUDURL QString(prefs.cloud_base_url)
|
||||
#define CLOUDREDIRECTURL CLOUDURL + "/cgi-bin/redirect.pl"
|
||||
|
||||
void QMLManager::saveCloudCredentials()
|
||||
void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &newPassword)
|
||||
{
|
||||
bool cloudCredentialsChanged = false;
|
||||
bool noCloud = QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_NOCLOUD;
|
||||
|
||||
QMLPrefs::instance()->setCloudUserName(newEmail);
|
||||
QMLPrefs::instance()->setCloudPassword(newPassword);
|
||||
|
||||
// make sure we only have letters, numbers, and +-_. in password and email address
|
||||
QRegularExpression regExp("^[a-zA-Z0-9@.+_-]+$");
|
||||
if (!noCloud) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue