mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-10 09:02:26 +02:00
Separate domain vs metaverse login denials for Interface.
This commit is contained in:
parent
84bee76968
commit
d3320ab17b
3 changed files with 31 additions and 9 deletions
|
@ -439,7 +439,7 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect
|
|||
|
||||
if (!userPerms.can(NodePermissions::Permission::canConnectToDomain)) {
|
||||
sendConnectionDeniedPacket("You lack the required permissions to connect to this domain.",
|
||||
nodeConnection.senderSockAddr, DomainHandler::ConnectionRefusedReason::NotAuthorized);
|
||||
nodeConnection.senderSockAddr, DomainHandler::ConnectionRefusedReason::NotAuthorizedMetaverse);
|
||||
#ifdef WANT_DEBUG
|
||||
qDebug() << "stalling login due to permissions:" << username;
|
||||
#endif
|
||||
|
|
|
@ -144,7 +144,8 @@ void DomainHandler::hardReset(QString reason) {
|
|||
bool DomainHandler::isHardRefusal(int reasonCode) {
|
||||
return (reasonCode == (int)ConnectionRefusedReason::ProtocolMismatch ||
|
||||
reasonCode == (int)ConnectionRefusedReason::TooManyUsers ||
|
||||
reasonCode == (int)ConnectionRefusedReason::NotAuthorized ||
|
||||
reasonCode == (int)ConnectionRefusedReason::NotAuthorizedMetaverse ||
|
||||
reasonCode == (int)ConnectionRefusedReason::NotAuthorizedDomain ||
|
||||
reasonCode == (int)ConnectionRefusedReason::TimedOut);
|
||||
}
|
||||
|
||||
|
@ -489,10 +490,25 @@ void DomainHandler::processICEResponsePacket(QSharedPointer<ReceivedMessage> mes
|
|||
}
|
||||
}
|
||||
|
||||
bool DomainHandler::reasonSuggestsLogin(ConnectionRefusedReason reasonCode) {
|
||||
bool DomainHandler::reasonSuggestsMetaverseLogin(ConnectionRefusedReason reasonCode) {
|
||||
switch (reasonCode) {
|
||||
case ConnectionRefusedReason::LoginError:
|
||||
case ConnectionRefusedReason::NotAuthorized:
|
||||
case ConnectionRefusedReason::NotAuthorizedMetaverse:
|
||||
return true;
|
||||
|
||||
default:
|
||||
case ConnectionRefusedReason::Unknown:
|
||||
case ConnectionRefusedReason::ProtocolMismatch:
|
||||
case ConnectionRefusedReason::TooManyUsers:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DomainHandler::reasonSuggestsDomainLogin(ConnectionRefusedReason reasonCode) {
|
||||
switch (reasonCode) {
|
||||
case ConnectionRefusedReason::LoginError:
|
||||
case ConnectionRefusedReason::NotAuthorizedDomain:
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -543,9 +559,9 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
|
|||
|
||||
auto accountManager = DependencyManager::get<AccountManager>();
|
||||
|
||||
// Some connection refusal reasons imply that a login is required. If so, suggest a new login
|
||||
if (reasonSuggestsLogin(reasonCode)) {
|
||||
qCWarning(networking) << "Make sure you are logged in.";
|
||||
// Some connection refusal reasons imply that a login is required. If so, suggest a new login.
|
||||
if (reasonSuggestsMetaverseLogin(reasonCode)) {
|
||||
qCWarning(networking) << "Make sure you are logged in to the metaverse.";
|
||||
|
||||
if (!_hasCheckedForAccessToken) {
|
||||
accountManager->checkAndSignalForAccessToken();
|
||||
|
@ -559,6 +575,10 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
|
|||
accountManager->generateNewUserKeypair();
|
||||
_connectionDenialsSinceKeypairRegen = 0;
|
||||
}
|
||||
} else if (reasonSuggestsDomainLogin(reasonCode)) {
|
||||
qCWarning(networking) << "Make sure you are logged in to the domain.";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,8 @@ public:
|
|||
Unknown,
|
||||
ProtocolMismatch,
|
||||
LoginError,
|
||||
NotAuthorized,
|
||||
NotAuthorizedMetaverse,
|
||||
NotAuthorizedDomain,
|
||||
TooManyUsers,
|
||||
TimedOut
|
||||
};
|
||||
|
@ -247,7 +248,8 @@ signals:
|
|||
void limitOfSilentDomainCheckInsReached();
|
||||
|
||||
private:
|
||||
bool reasonSuggestsLogin(ConnectionRefusedReason reasonCode);
|
||||
bool reasonSuggestsMetaverseLogin(ConnectionRefusedReason reasonCode);
|
||||
bool reasonSuggestsDomainLogin(ConnectionRefusedReason reasonCode);
|
||||
void sendDisconnectPacket();
|
||||
void hardReset(QString reason);
|
||||
|
||||
|
|
Loading…
Reference in a new issue