Skip to content

Commit

Permalink
Add and parse SASL failure because of required email verification
Browse files Browse the repository at this point in the history
  • Loading branch information
melvo committed Nov 27, 2023
1 parent 8e5d17f commit 004f25e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/base/QXmppStanza.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ class QXMPP_EXPORT QXmppStanza : public QXmppNonza
SubscriptionRequired, ///< The requester needs to subscribe first.
UndefinedCondition, ///< An undefined condition was hit.
UnexpectedRequest, ///< The request was unexpected.
PolicyViolation ///< The entity has violated a local server policy. \since QXmpp 1.3
PolicyViolation, ///< The entity has violated a local server policy. \since QXmpp 1.3
EmailVerificationRequired, ///< The server requires the entitiy to verify via email. \since QXmpp 1.6
};

Error();
Expand Down
3 changes: 3 additions & 0 deletions src/client/QXmppOutgoingClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,9 @@ void QXmppOutgoingClient::handleStanza(const QDomElement &nodeRecv)
// by remapping the error to "not-authorized".
if (failure.condition() == "not-authorized" || failure.condition() == "bad-auth") {
d->xmppStreamError = QXmppStanza::Error::NotAuthorized;
} else if ((failure.condition() == "account-disabled" || failure.condition() == "temporary-auth-failure") &&
QRegularExpression("(activate|activation)(email)", QRegularExpression::CaseInsensitiveOption).match(failure.text()).hasMatch()) {
d->xmppStreamError = QXmppStanza::Error::EmailVerificationRequired;
} else {
d->xmppStreamError = QXmppStanza::Error::UndefinedCondition;
}
Expand Down

0 comments on commit 004f25e

Please sign in to comment.