Better tracking of the status of the credentials

There are several parts of the UI that will do better if they know if the
credentials that we have are incomplete (e.g., no password), invalid
(server rejected them), valid (server accepted them) or potentially valid
(we found a local cache for the email address, so that's likely correct,
but because we are offline we cannot (or have not yet) verify the
passord).

So far this is specific for the mobile UI - it might make sense to try and
use the same backend code and status tracking for desktop and mobile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-02-10 17:45:23 -08:00
parent b7e353b7f6
commit e26e50f2e4
2 changed files with 40 additions and 0 deletions

View file

@ -9,6 +9,7 @@
class QMLManager : public QObject {
Q_OBJECT
Q_ENUMS(credentialStatus_t)
Q_PROPERTY(QString cloudUserName READ cloudUserName WRITE setCloudUserName NOTIFY cloudUserNameChanged)
Q_PROPERTY(QString cloudPassword READ cloudPassword WRITE setCloudPassword NOTIFY cloudPasswordChanged)
Q_PROPERTY(bool saveCloudPassword READ saveCloudPassword WRITE setSaveCloudPassword NOTIFY saveCloudPasswordChanged)
@ -19,10 +20,19 @@ class QMLManager : public QObject {
Q_PROPERTY(bool loadFromCloud READ loadFromCloud WRITE setLoadFromCloud NOTIFY loadFromCloudChanged)
Q_PROPERTY(QString startPageText READ startPageText WRITE setStartPageText NOTIFY startPageTextChanged)
Q_PROPERTY(bool verboseEnabled READ verboseEnabled WRITE setVerboseEnabled NOTIFY verboseEnabledChanged)
Q_PROPERTY(credentialStatus_t credentialStatus READ credentialStatus WRITE setCredentialStatus NOTIFY credentialStatusChanged)
public:
QMLManager();
~QMLManager();
enum credentialStatus_t {
INCOMPLETE,
UNKNOWN,
INVALID,
VALID_EMAIL,
VALID
};
static QMLManager *instance();
QString cloudUserName() const;
@ -53,6 +63,9 @@ public:
QString startPageText() const;
void setStartPageText(const QString& text);
credentialStatus_t credentialStatus() const;
void setCredentialStatus(const credentialStatus_t value);
QString logText() const;
void setLogText(const QString &logText);
void appendTextToLog(const QString &newText);
@ -112,6 +125,8 @@ private:
QNetworkReply *reply;
QNetworkRequest request;
credentialStatus_t m_credentialStatus;
signals:
void cloudUserNameChanged();
void cloudPasswordChanged();
@ -123,6 +138,7 @@ signals:
void distanceThresholdChanged();
void loadFromCloudChanged();
void startPageTextChanged();
void credentialStatusChanged();
};
#endif