From 033766d53d8223c753e80aaf0191d3ddec86d2d9 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 20 Apr 2016 14:50:21 +0200 Subject: [PATCH] Version blocking done right --- indra/newview/fspanellogin.cpp | 76 +++++++++++++++------------------- indra/newview/llstartup.cpp | 11 +++++ 2 files changed, 45 insertions(+), 42 deletions(-) diff --git a/indra/newview/fspanellogin.cpp b/indra/newview/fspanellogin.cpp index 15702e0384..28bf293333 100644 --- a/indra/newview/fspanellogin.cpp +++ b/indra/newview/fspanellogin.cpp @@ -941,52 +941,44 @@ void FSPanelLogin::onClickConnect(void *) std::string password = sInstance->getChild("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 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 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"); } } } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index d632923091..7ac876306d 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1142,6 +1142,17 @@ bool idle_startup() if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState()) { + // 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; + } + // + // 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.