mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
ad1c3892f9
commit
096f9773f0
3 changed files with 6 additions and 6 deletions
|
@ -98,7 +98,7 @@ Item {
|
||||||
id: registerpin
|
id: registerpin
|
||||||
text: qsTr("Register")
|
text: qsTr("Register")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
verifyCredentials(login.text, password.text, pin.text)
|
manager.saveCloudCredentials(login.text, password.text, pin.text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
|
@ -127,7 +127,7 @@ Item {
|
||||||
id: signin_register_normal
|
id: signin_register_normal
|
||||||
text: qsTr("Sign-in or Register")
|
text: qsTr("Sign-in or Register")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
manager.saveCloudCredentials(login.text, password.text)
|
manager.saveCloudCredentials(login.text, password.text, "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controls.Label {
|
Controls.Label {
|
||||||
|
|
|
@ -457,7 +457,7 @@ void QMLManager::finishSetup()
|
||||||
} else if (!empty_string(existing_filename) &&
|
} else if (!empty_string(existing_filename) &&
|
||||||
QMLPrefs::instance()->credentialStatus() != qPrefCloudStorage::CS_UNKNOWN) {
|
QMLPrefs::instance()->credentialStatus() != qPrefCloudStorage::CS_UNKNOWN) {
|
||||||
QMLPrefs::instance()->setCredentialStatus(qPrefCloudStorage::CS_NOCLOUD);
|
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"));
|
appendTextToLog(tr("working in no-cloud mode"));
|
||||||
int error = parse_file(existing_filename, &dive_table, &trip_table, &dive_site_table);
|
int error = parse_file(existing_filename, &dive_table, &trip_table, &dive_site_table);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -493,7 +493,7 @@ QMLManager *QMLManager::instance()
|
||||||
#define CLOUDURL QString(prefs.cloud_base_url)
|
#define CLOUDURL QString(prefs.cloud_base_url)
|
||||||
#define CLOUDREDIRECTURL CLOUDURL + "/cgi-bin/redirect.pl"
|
#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 cloudCredentialsChanged = false;
|
||||||
bool noCloud = QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_NOCLOUD;
|
bool noCloud = QMLPrefs::instance()->credentialStatus() == qPrefCloudStorage::CS_NOCLOUD;
|
||||||
|
@ -530,7 +530,7 @@ void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &ne
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noCloud &&
|
if (!noCloud &&
|
||||||
!verifyCredentials(newEmail, newPassword, QMLPrefs::instance()->cloudPin()))
|
!verifyCredentials(newEmail, newPassword, pin))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qPrefCloudStorage::set_cloud_storage_email(newEmail);
|
qPrefCloudStorage::set_cloud_storage_email(newEmail);
|
||||||
|
|
|
@ -167,7 +167,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void appInitialized();
|
void appInitialized();
|
||||||
void applicationStateChanged(Qt::ApplicationState state);
|
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);
|
bool verifyCredentials(QString email, QString password, QString pin);
|
||||||
void tryRetrieveDataFromBackend();
|
void tryRetrieveDataFromBackend();
|
||||||
void handleError(QNetworkReply::NetworkError nError);
|
void handleError(QNetworkReply::NetworkError nError);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue