Example #1
0
// static
void LLPanelLogin::onClickConnect(void *)
{
	if (sInstance && sInstance->mCallback)
	{
		// tell the responder we're not here anymore
		if ( gResponsePtr )
			gResponsePtr->setParent( 0 );

		// JC - Make sure the fields all get committed.
		sInstance->setFocus(FALSE);

		LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
		LLSD combo_val = combo->getSelectedValue();
		if (combo_val.isUndefined())
		{
			combo_val = combo->getValue();
		}
		if(combo_val.isUndefined())
		{
			LLNotificationsUtil::add("StartRegionEmpty");
			return;
		}		
		try
		{
			LLGridManager::getInstance()->setGridChoice(combo_val.asString());
		}
		catch (LLInvalidGridName ex)
		{
			LLSD args;
			args["GRID"] = combo_val.asString();
			LLNotificationsUtil::add("InvalidGrid", args);
			return;
		}
		updateStartSLURL();
		std::string username = sInstance->getChild<LLUICtrl>("username_edit")->getValue().asString();

		
		if(username.empty())
		{
			// user must type in something into the username field
			LLNotificationsUtil::add("MustHaveAccountToLogIn");
		}
		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");			
		}
	}
}
// static
void FSPanelLogin::onClickConnect(void *)
{
	if (sInstance && sInstance->mCallback)
	{
		// JC - Make sure the fields all get committed.
		sInstance->setFocus(FALSE);

		LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
		LLSD combo_val = combo->getSelectedValue();

		// the grid definitions may come from a user-supplied grids.xml, so they may not be good
		LL_DEBUGS("AppInit")<<"grid "<<combo_val.asString()<<LL_ENDL;
		try
		{
			LLGridManager::getInstance()->setGridChoice(combo_val.asString());
		}
		catch (LLInvalidGridName ex)
		{
			LLSD args;
			args["GRID"] = ex.name();
			LLNotificationsUtil::add("InvalidGrid", args);
			return;
		}

		// The start location SLURL has already been sent to LLStartUp::setStartSLURL

		std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
		gSavedSettings.setString("UserLoginInfo", credentialName()); // <FS:CR>

		LLSD blocked = FSData::instance().allowedLogin();
		if (!blocked.isMap()) //hack for testing for an empty LLSD
		{
			if(username.empty())
			{
				// user must type in something into the username field
				LLSD args;
				args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
				LLNotificationsUtil::add("MustHaveAccountToLogIn", args);
			}
			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");
			}
		}
		else
		{
			LLNotificationsUtil::add("BlockLoginInfo", blocked);
		}
	}
}
Example #3
0
// static
void LLPanelLogin::onClickConnect(void *)
{
	if (sInstance && sInstance->mCallback)
	{
		// JC - Make sure the fields all get committed.
		sInstance->setFocus(FALSE);

		LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
		LLSD combo_val = combo->getSelectedValue();
		if (combo_val.isUndefined())
		{
			combo_val = combo->getValue();
		}
		if(combo_val.isUndefined())
		{
			LLNotificationsUtil::add("StartRegionEmpty");
			return;
		}		

		std::string new_combo_value = combo_val.asString();
		if (!new_combo_value.empty())
		{
			std::string match = "://";
			size_t found = new_combo_value.find(match);
			if (found != std::string::npos)	
				new_combo_value.erase( 0,found+match.length());
		}

		try
		{
			LLGridManager::getInstance()->setGridChoice(new_combo_value);
		}
		catch (LLInvalidGridName ex)
		{
			LLSD args;
			args["GRID"] = ex.name();
			LLNotificationsUtil::add("InvalidGrid", args);
			return;
		}
		updateStartSLURL();
		std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
		gSavedSettings.setString("UserLoginInfo", credential_name());

		LLSD blocked = FSData::getInstance()->allowed_login();
		if (!blocked.isMap()) //hack for testing for an empty LLSD
		{
			if(username.empty())
			{
				LLSD args;
				args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
				// user must type in something into the username field
				LLNotificationsUtil::add("MustHaveAccountToLogIn", args);
			}
			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");			
			}
		}
	}
}