mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 15:05:19 +03:00
[CSE] Move the e2e object to the Account
This is important as a lot of the code would start to rely in direct access to the client side encryption and there are different keys for different accounts.
This commit is contained in:
parent
6351c01ee7
commit
a0f0e5617a
4 changed files with 15 additions and 4 deletions
|
@ -50,9 +50,18 @@ AccountPtr Account::create()
|
||||||
{
|
{
|
||||||
AccountPtr acc = AccountPtr(new Account);
|
AccountPtr acc = AccountPtr(new Account);
|
||||||
acc->setSharedThis(acc);
|
acc->setSharedThis(acc);
|
||||||
|
|
||||||
|
//TODO: This probably needs to have a better
|
||||||
|
// coupling, but it should work for now.
|
||||||
|
acc->e2e().setAccount(acc);
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClientSideEncryption& Account::e2e()
|
||||||
|
{
|
||||||
|
return _e2e;
|
||||||
|
}
|
||||||
|
|
||||||
Account::~Account()
|
Account::~Account()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,6 +226,8 @@ public:
|
||||||
/// Called by network jobs on credential errors, emits invalidCredentials()
|
/// Called by network jobs on credential errors, emits invalidCredentials()
|
||||||
void handleInvalidCredentials();
|
void handleInvalidCredentials();
|
||||||
|
|
||||||
|
ClientSideEncryption& e2e();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/// Used when forgetting credentials
|
/// Used when forgetting credentials
|
||||||
void clearQNAMCache();
|
void clearQNAMCache();
|
||||||
|
@ -283,6 +285,8 @@ private:
|
||||||
static QString _configFileName;
|
static QString _configFileName;
|
||||||
|
|
||||||
QString _davPath; // defaults to value from theme, might be overwritten in brandings
|
QString _davPath; // defaults to value from theme, might be overwritten in brandings
|
||||||
|
ClientSideEncryption _e2e;
|
||||||
|
|
||||||
friend class AccountManager;
|
friend class AccountManager;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,9 +326,8 @@ void ConnectionValidator::slotUserFetched(const QJsonDocument &json)
|
||||||
void ConnectionValidator::slotAvatarImage(const QImage &img)
|
void ConnectionValidator::slotAvatarImage(const QImage &img)
|
||||||
{
|
{
|
||||||
_account->setAvatar(img);
|
_account->setAvatar(img);
|
||||||
cse.setAccount(_account);
|
connect(&_account->e2e(), &ClientSideEncryption::initializationFinished, this, &ConnectionValidator::reportConnected);
|
||||||
connect(&cse, &ClientSideEncryption::initializationFinished, this, &ConnectionValidator::reportConnected);
|
_account->e2e().initialize();
|
||||||
cse.initialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionValidator::reportConnected() {
|
void ConnectionValidator::reportConnected() {
|
||||||
|
|
|
@ -144,7 +144,6 @@ private:
|
||||||
QStringList _errors;
|
QStringList _errors;
|
||||||
AccountPtr _account;
|
AccountPtr _account;
|
||||||
bool _isCheckingServerAndAuth;
|
bool _isCheckingServerAndAuth;
|
||||||
ClientSideEncryption cse;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue