mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 13:55:47 +03:00
Credentials: Namespace windows cred keys #6125
The application name is prepended to the key. QtKeychain doesn't do that automatically on the platform.
This commit is contained in:
parent
64a84fda38
commit
6ac44f05cd
1 changed files with 10 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <QLoggingCategory>
|
||||
#include <QString>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "common/asserts.h"
|
||||
#include "creds/abstractcredentials.h"
|
||||
|
@ -53,6 +54,15 @@ QString AbstractCredentials::keychainKey(const QString &url, const QString &user
|
|||
QString key = user + QLatin1Char(':') + u;
|
||||
if (!accountId.isEmpty()) {
|
||||
key += QLatin1Char(':') + accountId;
|
||||
#ifdef Q_OS_WIN
|
||||
// On Windows the credential keys aren't namespaced properly
|
||||
// by qtkeychain. To work around that we manually add namespacing
|
||||
// to the generated keys. See #6125.
|
||||
// It's safe to do that since the key format is changing for 2.4
|
||||
// anyway to include the account ids. That means old keys can be
|
||||
// migrated to new namespaced keys on windows for 2.4.
|
||||
key.prepend(QCoreApplication::applicationName() + "_");
|
||||
#endif
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue