summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2019-12-27 13:56:33 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-28 08:34:56 -0800
commit096f9773f0812d9713292ac2e2e1d4dc9f88ecde (patch)
treeb78ec9400cbc32316784b7532591444e4a18a9f1 /mobile-widgets
parentad1c3892f97fd1a95398182974397682e2c5521c (diff)
downloadsubsurface-096f9773f0812d9713292ac2e2e1d4dc9f88ecde.tar.gz
mobile-widgets: make saveCredentials() an atom
Add pin parameter to saveCredentials() thereby having all info about credentials in one function call. Add "" as pin in saveCredentials() - main.qml, when verifying credentials. replace verifyCredentials() with saveCredentials() in the register button on the pin page. Signed-off-by: Jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/CloudCredentials.qml4
-rw-r--r--mobile-widgets/qmlmanager.cpp6
-rw-r--r--mobile-widgets/qmlmanager.h2
3 files changed, 6 insertions, 6 deletions
diff --git a/mobile-widgets/qml/CloudCredentials.qml b/mobile-widgets/qml/CloudCredentials.qml
index 351c25d1d..cbf3bac46 100644
--- a/mobile-widgets/qml/CloudCredentials.qml
+++ b/mobile-widgets/qml/CloudCredentials.qml
@@ -98,7 +98,7 @@ Item {
id: registerpin
text: qsTr("Register")
onClicked: {
- verifyCredentials(login.text, password.text, pin.text)
+ manager.saveCloudCredentials(login.text, password.text, pin.text)
}
}
Controls.Label {
@@ -127,7 +127,7 @@ Item {
id: signin_register_normal
text: qsTr("Sign-in or Register")
onClicked: {
- manager.saveCloudCredentials(login.text, password.text)
+ manager.saveCloudCredentials(login.text, password.text, "")
}
}
Controls.Label {
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 801df3de5..2f72fa1c7 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -457,7 +457,7 @@ void QMLManager::finishSetup()
} else if (!empty_string(existing_filename) &&
QMLPrefs::instance()->credentialStatus() != qPrefCloudStorage::CS_UNKNOWN) {
QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_NOCLOUD);
- saveCloudCredentials(qPrefCloudStorage::cloud_storage_email(), qPrefCloudStorage::cloud_storage_password());
+ saveCloudCredentials(qPrefCloudStorage::cloud_storage_email(), qPrefCloudStorage::cloud_storage_password(), qPrefCloudStorage::cloud_storage_pin());
appendTextToLog(tr("working in no-cloud mode"));
int error = parse_file(existing_filename, &dive_table, &trip_table, &dive_site_table);
if (error) {
@@ -493,7 +493,7 @@ QMLManager *QMLManager::instance()
#define CLOUDURL QString(prefs.cloud_base_url)
#define CLOUDREDIRECTURL CLOUDURL + "/cgi-bin/redirect.pl"
-void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &newPassword)
+void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &newPassword, const QString &pin)
{
bool cloudCredentialsChanged = false;
bool noCloud = QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_NOCLOUD;
@@ -530,7 +530,7 @@ void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &ne
}
if (!noCloud &&
- !verifyCredentials(newEmail, newPassword, QMLPrefs::instance()->cloudPin()))
+ !verifyCredentials(newEmail, newPassword, pin))
return;
qPrefCloudStorage::set_cloud_storage_email(newEmail);
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index 14baf6dd8..12a8496e8 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -167,7 +167,7 @@ public:
public slots:
void appInitialized();
void applicationStateChanged(Qt::ApplicationState state);
- void saveCloudCredentials(const QString &email, const QString &password);
+ void saveCloudCredentials(const QString &email, const QString &password, const QString &pin);
bool verifyCredentials(QString email, QString password, QString pin);
void tryRetrieveDataFromBackend();
void handleError(QNetworkReply::NetworkError nError);