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);
|
||||
acc->setSharedThis(acc);
|
||||
|
||||
//TODO: This probably needs to have a better
|
||||
// coupling, but it should work for now.
|
||||
acc->e2e().setAccount(acc);
|
||||
return acc;
|
||||
}
|
||||
|
||||
ClientSideEncryption& Account::e2e()
|
||||
{
|
||||
return _e2e;
|
||||
}
|
||||
|
||||
Account::~Account()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -226,6 +226,8 @@ public:
|
|||
/// Called by network jobs on credential errors, emits invalidCredentials()
|
||||
void handleInvalidCredentials();
|
||||
|
||||
ClientSideEncryption& e2e();
|
||||
|
||||
public slots:
|
||||
/// Used when forgetting credentials
|
||||
void clearQNAMCache();
|
||||
|
@ -283,6 +285,8 @@ private:
|
|||
static QString _configFileName;
|
||||
|
||||
QString _davPath; // defaults to value from theme, might be overwritten in brandings
|
||||
ClientSideEncryption _e2e;
|
||||
|
||||
friend class AccountManager;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -326,9 +326,8 @@ void ConnectionValidator::slotUserFetched(const QJsonDocument &json)
|
|||
void ConnectionValidator::slotAvatarImage(const QImage &img)
|
||||
{
|
||||
_account->setAvatar(img);
|
||||
cse.setAccount(_account);
|
||||
connect(&cse, &ClientSideEncryption::initializationFinished, this, &ConnectionValidator::reportConnected);
|
||||
cse.initialize();
|
||||
connect(&_account->e2e(), &ClientSideEncryption::initializationFinished, this, &ConnectionValidator::reportConnected);
|
||||
_account->e2e().initialize();
|
||||
}
|
||||
|
||||
void ConnectionValidator::reportConnected() {
|
||||
|
|
|
@ -144,7 +144,6 @@ private:
|
|||
QStringList _errors;
|
||||
AccountPtr _account;
|
||||
bool _isCheckingServerAndAuth;
|
||||
ClientSideEncryption cse;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue