Skip to content

Commit

Permalink
Merge pull request #1222 from deXol/develop
Browse files Browse the repository at this point in the history
Fix adding TOTP for multiple domain service
  • Loading branch information
limpkin authored Apr 22, 2024
2 parents 261a8c0 + dae2059 commit c187a04
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/MPDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7827,8 +7827,15 @@ void MPDevice::setMMCredentials(const QJsonArray &creds, bool noDelete,
int keyAfterLogin = 0;
int keyAfterPwd = 0;
QString multipleDomains = "";
QString servicePwd = service;
if (isBLE())
{
multipleDomains = qjobject["multiple_domains"].toString();
// For multiple domain we need the add the first domain to service name for password save
if (!multipleDomains.isEmpty())
{
servicePwd += Common::getFirstDomain(multipleDomains);
}
category = qjobject["category"].toInt();
keyAfterLogin = qjobject["key_after_login"].toInt();
keyAfterPwd = qjobject["key_after_pwd"].toInt();
Expand All @@ -7842,20 +7849,13 @@ void MPDevice::setMMCredentials(const QJsonArray &creds, bool noDelete,

if (!totpObject["totp_secret_key"].toString().isEmpty())
{
bleImpl->createTOTPCredMessage(service, login, qjobject["totp"].toObject());
bleImpl->createTOTPCredMessage(servicePwd, login, qjobject["totp"].toObject());
}
}
QJsonArray pointedToAddr = qjobject["pointed_to_child"].toArray();
for (qint32 j = 0; j < pointedToAddr.size(); j++) { pointedToAddrArray.append(pointedToAddr[j].toInt()); }

multipleDomains = qjobject["multiple_domains"].toString();
}
QString servicePwd = service;
// For multiple domain we need the add the first domain to service name for password save
if (!multipleDomains.isEmpty())
{
servicePwd += Common::getFirstDomain(multipleDomains);
}

for (qint32 j = 0; j < addrArray.size(); j++) { nodeAddr.append(addrArray[j].toInt()); }
qDebug() << "MMM Save: tackling " << login << " for service " << service << " at address " << nodeAddr.toHex();

Expand Down

0 comments on commit c187a04

Please sign in to comment.