diff options
| author | Tannin <devnull@localhost> | 2015-08-09 12:40:57 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-08-09 12:40:57 +0200 |
| commit | ff8057d34bb4e9cf12f5d39b5c1b79ac092b387f (patch) | |
| tree | 6e13de3aa2a4b8ebf3bf771f59d5bdfe2de2f096 /src/nxmaccessmanager.h | |
| parent | 8cf429a1dd0d99790f2564b3ad363788e224711a (diff) | |
- MO now validates session cookie on startup
- It also retrieves account status
- rewrote how MO decides when to log-in/when to give up on logging in
Diffstat (limited to 'src/nxmaccessmanager.h')
| -rw-r--r-- | src/nxmaccessmanager.h | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/src/nxmaccessmanager.h b/src/nxmaccessmanager.h index 9d692bba..2b615cdc 100644 --- a/src/nxmaccessmanager.h +++ b/src/nxmaccessmanager.h @@ -25,6 +25,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QTimer>
#include <QNetworkReply>
#include <QProgressDialog>
+#include <set>
/**
@@ -43,12 +44,18 @@ public: bool loggedIn() const;
- bool loginAttempted() const { return m_LoginAttempted; }
+ bool loginAttempted() const;
bool loginWaiting() const;
void login(const QString &username, const QString &password);
- void showCookies();
+ void showCookies() const;
+
+ QString userAgent(const QString &subModule = QString()) const;
+
+ void startLoginCheck();
+
+ void refuseLogin();
signals:
@@ -68,11 +75,14 @@ signals: void loginFailed(const QString &message);
- private slots:
+ void credentialsReceived(const QString &userName, bool premium);
+
+private slots:
- void loginFinished();
- void loginError(QNetworkReply::NetworkError errorCode);
- void loginTimeout();
+ void loginChecked();
+ void loginFinished();
+ void loginError(QNetworkReply::NetworkError errorCode);
+ void loginTimeout();
public slots:
@@ -84,10 +94,16 @@ protected: private:
- void pageLogin();
+ void pageLogin();
// void dlLogin();
- bool hasLoginCookies() const;
+ bool hasLoginCookies() const;
+
+ void retrieveCredentials();
+
+private:
+
+ static const std::set<int> s_PremiumAccountStates;
private:
@@ -102,6 +118,14 @@ private: QString m_Password;
bool m_LoginAttempted;
+ enum {
+ LOGIN_NOT_CHECKED,
+ LOGIN_CHECKING,
+ LOGIN_NOT_VALID,
+ LOGIN_ATTEMPT_FAILED,
+ LOGIN_REFUSED,
+ LOGIN_VALID
+ } m_LoginState = LOGIN_NOT_CHECKED;
};
|
