mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 05:25:50 +03:00
Account: Save accepted SSL certs immediatly #3617
This commit is contained in:
parent
76ce5adbf0
commit
38b8508f15
4 changed files with 18 additions and 0 deletions
|
@ -129,6 +129,14 @@ void AccountManager::save(bool saveCredentials)
|
|||
}
|
||||
}
|
||||
|
||||
void AccountManager::wantsAccountSavedSlot(AccountPtr a)
|
||||
{
|
||||
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
|
||||
settings->beginGroup(a->id());
|
||||
save(a, *settings, true);
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void AccountManager::save(const AccountPtr& acc, QSettings& settings, bool saveCredentials)
|
||||
{
|
||||
settings.setValue(QLatin1String(urlC), acc->_url.toString());
|
||||
|
@ -206,6 +214,9 @@ AccountState *AccountManager::addAccount(const AccountPtr& newAccount)
|
|||
}
|
||||
newAccount->_id = id;
|
||||
|
||||
QObject::connect(newAccount.data(), SIGNAL(wantsAccountSaved(AccountPtr)),
|
||||
this, SLOT(wantsAccountSavedSlot(AccountPtr)));
|
||||
|
||||
AccountStatePtr newAccountState(new AccountState(newAccount));
|
||||
_accounts << newAccountState;
|
||||
emit accountAdded(newAccountState.data());
|
||||
|
|
|
@ -78,6 +78,9 @@ private:
|
|||
bool isAccountIdAvailable(const QString& id) const;
|
||||
QString generateFreeAccountId() const;
|
||||
|
||||
public slots:
|
||||
void wantsAccountSavedSlot(AccountPtr a);
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void accountAdded(AccountState *account);
|
||||
|
|
|
@ -399,6 +399,7 @@ void Account::slotHandleSslErrors(QNetworkReply *reply , QList<QSslError> errors
|
|||
if (_sslErrorHandler->handleErrors(errors, reply->sslConfiguration(), &approvedCerts, sharedFromThis())) {
|
||||
QSslSocket::addDefaultCaCertificates(approvedCerts);
|
||||
addApprovedCerts(approvedCerts);
|
||||
emit wantsAccountSaved(sharedFromThis());
|
||||
// all ssl certs are known and accepted. We can ignore the problems right away.
|
||||
// qDebug() << out << "Certs are known and trusted! This is not an actual error.";
|
||||
|
||||
|
|
|
@ -167,6 +167,9 @@ signals:
|
|||
/// Forwards from QNetworkAccessManager::proxyAuthenticationRequired().
|
||||
void proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*);
|
||||
|
||||
// e.g. when the approved SSL certificates changed
|
||||
void wantsAccountSaved(AccountPtr acc);
|
||||
|
||||
protected Q_SLOTS:
|
||||
void slotHandleSslErrors(QNetworkReply*,QList<QSslError>);
|
||||
void slotCredentialsFetched();
|
||||
|
|
Loading…
Reference in a new issue