forked from blue/squawk
actual pasword reasking on failed authentication
This commit is contained in:
parent
ce686e121b
commit
8f949277f6
13 changed files with 347 additions and 28 deletions
|
@ -260,7 +260,10 @@ void Core::Squawk::disconnectAccount(const QString& account)
|
|||
void Core::Squawk::onAccountConnectionStateChanged(Shared::ConnectionState p_state)
|
||||
{
|
||||
Account* acc = static_cast<Account*>(sender());
|
||||
emit changeAccount(acc->getName(), {{"state", QVariant::fromValue(p_state)}});
|
||||
emit changeAccount(acc->getName(), {
|
||||
{"state", QVariant::fromValue(p_state)},
|
||||
{"error", ""}
|
||||
});
|
||||
|
||||
#ifdef WITH_KWALLET
|
||||
if (p_state == Shared::ConnectionState::connected) {
|
||||
|
@ -398,6 +401,7 @@ void Core::Squawk::modifyAccountRequest(const QString& name, const QMap<QString,
|
|||
Shared::ConnectionState st = acc->getState();
|
||||
QMap<QString, QVariant>::const_iterator mItr;
|
||||
bool needToReconnect = false;
|
||||
bool wentReconnecting = false;
|
||||
|
||||
mItr = map.find("login");
|
||||
if (mItr != map.end()) {
|
||||
|
@ -428,6 +432,7 @@ void Core::Squawk::modifyAccountRequest(const QString& name, const QMap<QString,
|
|||
if (mItr == map.end() || mItr->toBool() == acc->getActive()) {
|
||||
if (needToReconnect && st != Shared::ConnectionState::disconnected) {
|
||||
acc->reconnect();
|
||||
wentReconnecting = true;
|
||||
}
|
||||
} else {
|
||||
acc->setActive(mItr->toBool());
|
||||
|
@ -468,8 +473,12 @@ void Core::Squawk::modifyAccountRequest(const QString& name, const QMap<QString,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (activeChanged && acc->getActive() && state != Shared::Availability::offline) {
|
||||
acc->connect();
|
||||
if (state != Shared::Availability::offline) {
|
||||
if (activeChanged && acc->getActive()) {
|
||||
acc->connect();
|
||||
} else if (!wentReconnecting && acc->getActive() && acc->getLastError() == Account::Error::authentication) {
|
||||
acc->connect();
|
||||
}
|
||||
}
|
||||
|
||||
emit changeAccount(name, map);
|
||||
|
@ -479,6 +488,10 @@ void Core::Squawk::onAccountError(const QString& text)
|
|||
{
|
||||
Account* acc = static_cast<Account*>(sender());
|
||||
emit changeAccount(acc->getName(), {{"error", text}});
|
||||
|
||||
if (acc->getLastError() == Account::Error::authentication) {
|
||||
emit requestPassword(acc->getName(), true);
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Squawk::removeAccountRequest(const QString& name)
|
||||
|
@ -733,7 +746,7 @@ void Core::Squawk::onAccountNeedPassword()
|
|||
Account* acc = static_cast<Account*>(sender());
|
||||
switch (acc->getPasswordType()) {
|
||||
case Shared::AccountPassword::alwaysAsk:
|
||||
emit requestPassword(acc->getName());
|
||||
emit requestPassword(acc->getName(), false);
|
||||
break;
|
||||
case Shared::AccountPassword::kwallet: {
|
||||
#ifdef WITH_KWALLET
|
||||
|
@ -741,7 +754,7 @@ void Core::Squawk::onAccountNeedPassword()
|
|||
kwallet.requestReadPassword(acc->getName());
|
||||
} else {
|
||||
#endif
|
||||
emit requestPassword(acc->getName());
|
||||
emit requestPassword(acc->getName(), false);
|
||||
#ifdef WITH_KWALLET
|
||||
}
|
||||
#endif
|
||||
|
@ -754,7 +767,7 @@ void Core::Squawk::onAccountNeedPassword()
|
|||
|
||||
void Core::Squawk::onWalletRejectPassword(const QString& login)
|
||||
{
|
||||
emit requestPassword(login);
|
||||
emit requestPassword(login, false);
|
||||
}
|
||||
|
||||
void Core::Squawk::responsePassword(const QString& account, const QString& password)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue