Fix CardDAV authentication and allow multiple accounts
CardDAV fixes: - Extract domain from URI for auth info lookup - Auto-populate realm from host if empty - Add domain parameter to createAuthInfo for proper auth matching - Update liblinphone submodule with setAuthInfo fix UI improvements: - Allow multiple CardDAV accounts (removed count==0 restriction) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
fdee074dc9
commit
b19d96f82c
3 changed files with 23 additions and 5 deletions
|
|
@ -22,6 +22,7 @@
|
|||
#include "model/core/CoreModel.hpp"
|
||||
#include "model/setting/SettingsModel.hpp"
|
||||
#include "tool/Utils.hpp"
|
||||
#include <QUrl>
|
||||
|
||||
DEFINE_ABSTRACT_OBJECT(CarddavModel)
|
||||
|
||||
|
|
@ -59,16 +60,32 @@ void CarddavModel::save(
|
|||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
auto core = CoreModel::getInstance()->getCore();
|
||||
|
||||
// Extract domain from URI for auth info lookup
|
||||
string domain;
|
||||
QUrl url(QString::fromStdString(uri));
|
||||
if (url.isValid()) {
|
||||
domain = url.host().toStdString();
|
||||
}
|
||||
|
||||
// If realm is empty, use domain as default realm
|
||||
if (realm.empty() && !domain.empty()) {
|
||||
realm = domain;
|
||||
lInfo() << log().arg("Using host as default realm:") << realm;
|
||||
}
|
||||
|
||||
lInfo() << log().arg("CardDAV save called with:") << " displayName=" << displayName << " uri=" << uri
|
||||
<< " username=" << username << " realm=" << realm << " domain=" << domain << " (password hidden)";
|
||||
|
||||
// Auth info handled in lazy mode, if provided handle otherwise ignore.
|
||||
// TODO: add dialog to ask user before removing existing auth info if existing already - (comment from Android)
|
||||
if (!username.empty() && !realm.empty()) {
|
||||
mRemovedAuthInfo = core->findAuthInfo(realm, username, "");
|
||||
mRemovedAuthInfo = core->findAuthInfo(realm, username, domain);
|
||||
if (mRemovedAuthInfo != nullptr) {
|
||||
lWarning() << log().arg("Auth info with username ") << username << " already exists, removing it first.";
|
||||
core->removeAuthInfo(mRemovedAuthInfo);
|
||||
}
|
||||
lInfo() << log().arg("Adding auth info with username") << username;
|
||||
mCreatedAuthInfo = linphone::Factory::get()->createAuthInfo(username, "", password, "", realm, "");
|
||||
lInfo() << log().arg("Adding auth info with username ") << username << " and domain " << domain;
|
||||
mCreatedAuthInfo = linphone::Factory::get()->createAuthInfo(username, "", password, "", realm, domain);
|
||||
core->addAuthInfo(mCreatedAuthInfo);
|
||||
} else {
|
||||
lInfo() << log().arg("No auth info provided upon saving.");
|
||||
|
|
|
|||
|
|
@ -79,7 +79,8 @@ AbstractSettingsLayout {
|
|||
accessibleUseButtonText: qsTr("use_cardav_server_accessible_name")
|
||||
proxyModel: CarddavProxy {
|
||||
onModelReset: {
|
||||
carddavProvider.showAddButton = carddavProvider.proxyModel.count == 0
|
||||
// Allow multiple CardDAV accounts
|
||||
carddavProvider.showAddButton = true
|
||||
carddavProvider.newItemGui = createGuiObject('Carddav')
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
external/linphone-sdk
vendored
2
external/linphone-sdk
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 2e6e6b927ce202f6948da02ea33081a52b89bf48
|
||||
Subproject commit 4193a9481e6d8530bec6f6af26efb59285a53e0e
|
||||
Loading…
Reference in a new issue