Version blocking done right

meow-7.2.2
Ansariel 2016-04-20 14:50:21 +02:00
parent f1469a95bb
commit 033766d53d
2 changed files with 45 additions and 42 deletions

View File

@ -941,52 +941,44 @@ void FSPanelLogin::onClickConnect(void *)
std::string password = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
gSavedSettings.setString("UserLoginInfo", credentialName());
LLSD blocked = FSData::instance().allowedLogin();
if (!blocked.isMap()) //hack for testing for an empty LLSD
if(username.empty())
{
if(username.empty())
{
// user must type in something into the username field
LLNotificationsUtil::add("MustHaveAccountToLogIn");
}
else if(password.empty())
{
LLNotificationsUtil::add("MustEnterPasswordToLogIn");
}
else
{
LLPointer<LLCredential> cred;
BOOL remember;
getFields(cred, remember);
std::string identifier_type;
cred->identifierType(identifier_type);
LLSD allowed_credential_types;
LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types);
// check the typed in credential type against the credential types expected by the server.
for(LLSD::array_iterator i = allowed_credential_types.beginArray();
i != allowed_credential_types.endArray();
i++)
{
if(i->asString() == identifier_type)
{
// yay correct credential type
sInstance->mCallback(0, sInstance->mCallbackData);
return;
}
}
// Right now, maingrid is the only thing that is picky about
// credential format, as it doesn't yet allow account (single username)
// format creds. - Rox. James, we wanna fix the message when we change
// this.
LLNotificationsUtil::add("InvalidCredentialFormat");
}
// user must type in something into the username field
LLNotificationsUtil::add("MustHaveAccountToLogIn");
}
else if(password.empty())
{
LLNotificationsUtil::add("MustEnterPasswordToLogIn");
}
else
{
LLNotificationsUtil::add("BlockLoginInfo", blocked);
LLPointer<LLCredential> cred;
BOOL remember;
getFields(cred, remember);
std::string identifier_type;
cred->identifierType(identifier_type);
LLSD allowed_credential_types;
LLGridManager::getInstance()->getLoginIdentifierTypes(allowed_credential_types);
// check the typed in credential type against the credential types expected by the server.
for(LLSD::array_iterator i = allowed_credential_types.beginArray();
i != allowed_credential_types.endArray();
i++)
{
if(i->asString() == identifier_type)
{
// yay correct credential type
sInstance->mCallback(0, sInstance->mCallbackData);
return;
}
}
// Right now, maingrid is the only thing that is picky about
// credential format, as it doesn't yet allow account (single username)
// format creds. - Rox. James, we wanna fix the message when we change
// this.
LLNotificationsUtil::add("InvalidCredentialFormat");
}
}
}

View File

@ -1142,6 +1142,17 @@ bool idle_startup()
if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState())
{
// <FS:Ansariel> Login block
LLSD blocked = FSData::instance().allowedLogin();
if (blocked.isMap()) //hack for testing for an empty LLSD
{
LLNotificationsUtil::add("BlockLoginInfo", blocked, LLSD(), login_alert_done);
LLStartUp::setStartupState(STATE_LOGIN_CONFIRM_NOTIFICATON);
show_connect_box = true;
return FALSE;
}
// </FS:Ansariel>
// Post login screen, we should see if any settings have changed that may
// require us to either start/stop or change the socks proxy. As various communications
// past this point may require the proxy to be up.