mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 09:57:51 +02:00
add temporary domain info to account info
This commit is contained in:
parent
b6b73af2b4
commit
3a36b0a2e5
4 changed files with 25 additions and 4 deletions
|
@ -471,6 +471,11 @@ void AccountManager::setAccessTokenForCurrentAuthURL(const QString& accessToken)
|
|||
persistAccountToFile();
|
||||
}
|
||||
|
||||
void AccountManager::setTemporaryDomain(const QUuid& domainID, const QString& key) {
|
||||
_accountInfo.setTemporaryDomain(domainID, key);
|
||||
persistAccountToFile();
|
||||
}
|
||||
|
||||
void AccountManager::requestAccessToken(const QString& login, const QString& password) {
|
||||
|
||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||
|
|
|
@ -88,6 +88,9 @@ public:
|
|||
|
||||
void setSessionID(const QUuid& sessionID) { _sessionID = sessionID; }
|
||||
|
||||
void setTemporaryDomain(const QUuid& domainID, const QString& key);
|
||||
const QString& getTemporaryDomainKey(const QUuid& domainID) { return _accountInfo.getTemporaryDomainKey(domainID); }
|
||||
|
||||
public slots:
|
||||
void requestAccessToken(const QString& login, const QString& password);
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
const QString DataServerAccountInfo::EMPTY_KEY = QString();
|
||||
|
||||
DataServerAccountInfo::DataServerAccountInfo(const DataServerAccountInfo& otherInfo) : QObject() {
|
||||
_accessToken = otherInfo._accessToken;
|
||||
_username = otherInfo._username;
|
||||
|
@ -33,6 +35,8 @@ DataServerAccountInfo::DataServerAccountInfo(const DataServerAccountInfo& otherI
|
|||
_walletID = otherInfo._walletID;
|
||||
_privateKey = otherInfo._privateKey;
|
||||
_domainID = otherInfo._domainID;
|
||||
_temporaryDomainID = otherInfo._temporaryDomainID;
|
||||
_temporaryDomainApiKey = otherInfo._temporaryDomainApiKey;
|
||||
}
|
||||
|
||||
DataServerAccountInfo& DataServerAccountInfo::operator=(const DataServerAccountInfo& otherInfo) {
|
||||
|
@ -51,6 +55,8 @@ void DataServerAccountInfo::swap(DataServerAccountInfo& otherInfo) {
|
|||
swap(_walletID, otherInfo._walletID);
|
||||
swap(_privateKey, otherInfo._privateKey);
|
||||
swap(_domainID, otherInfo._domainID);
|
||||
swap(_temporaryDomainID, otherInfo._temporaryDomainID);
|
||||
swap(_temporaryDomainApiKey, otherInfo._temporaryDomainApiKey);
|
||||
}
|
||||
|
||||
void DataServerAccountInfo::setAccessTokenFromJSON(const QJsonObject& jsonObject) {
|
||||
|
@ -145,13 +151,14 @@ QByteArray DataServerAccountInfo::signPlaintext(const QByteArray& plaintext) {
|
|||
|
||||
QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info) {
|
||||
out << info._accessToken << info._username << info._xmppPassword << info._discourseApiKey
|
||||
<< info._walletID << info._privateKey << info._domainID;
|
||||
|
||||
<< info._walletID << info._privateKey << info._domainID
|
||||
<< info._temporaryDomainID << info._temporaryDomainApiKey;
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream& operator>>(QDataStream &in, DataServerAccountInfo& info) {
|
||||
in >> info._accessToken >> info._username >> info._xmppPassword >> info._discourseApiKey
|
||||
>> info._walletID >> info._privateKey >> info._domainID;
|
||||
>> info._walletID >> info._privateKey >> info._domainID
|
||||
>> info._temporaryDomainID >> info._temporaryDomainApiKey;
|
||||
return in;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ const float SATOSHIS_PER_CREDIT = 100000000.0f;
|
|||
|
||||
class DataServerAccountInfo : public QObject {
|
||||
Q_OBJECT
|
||||
const static QString EMPTY_KEY;
|
||||
public:
|
||||
DataServerAccountInfo() {};
|
||||
DataServerAccountInfo(const DataServerAccountInfo& otherInfo);
|
||||
|
@ -52,6 +53,9 @@ public:
|
|||
void setDomainID(const QUuid& domainID) { _domainID = domainID; }
|
||||
const QUuid& getDomainID() const { return _domainID; }
|
||||
|
||||
void setTemporaryDomain(const QUuid& domainID, const QString& key) { _temporaryDomainID = domainID; _temporaryDomainApiKey = key; }
|
||||
const QString& getTemporaryDomainKey(const QUuid& domainID) { return domainID == _temporaryDomainID ? _temporaryDomainApiKey : EMPTY_KEY; }
|
||||
|
||||
bool hasProfile() const;
|
||||
|
||||
void setProfileInfoFromJSON(const QJsonObject& jsonObject);
|
||||
|
@ -67,7 +71,9 @@ private:
|
|||
QString _xmppPassword;
|
||||
QString _discourseApiKey;
|
||||
QUuid _walletID;
|
||||
QUuid _domainID; // if this holds account info for a domain, this holds the ID of that domain
|
||||
QUuid _domainID;
|
||||
QUuid _temporaryDomainID;
|
||||
QString _temporaryDomainApiKey;
|
||||
QByteArray _privateKey;
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue