示例#1
0
// static
void LLPanelLogin::onSelectSavedLogin(LLUICtrl*, void*)
{
	// *NOTE: The paramters for this method are ignored. 
	LL_INFOS("AppInit") << "onSelectSavedLogin" << LL_ENDL;

	
	LLComboBox* combo = sInstance->getChild<LLComboBox>("username_combo");
	LLSD combo_val = combo->getSelectedValue();
	if (combo_val.isUndefined())
	{
		combo_val = combo->getValue();
	}

	
	std::string credName = combo_val.asString();
	
	if(combo_val.asString().find("@")<0)		
		return;


	// if they've selected another grid, we should load the credentials
	// for that grid and set them to the UI.
	if(sInstance)
	{
		LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(credName);
		if(credential->getIdentifier()["first_name"].asString().size()<=0 && credential->getIdentifier()["account_name"].asString().size()<=0 ) return;
		LLSD authenticator = credential->getAuthenticator();
		sInstance->setFields(credential);
	}

}
示例#2
0
// static
void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
							 BOOL remember)
{
	if (!sInstance)
	{
		llwarns << "Attempted fillFields with no login view shown" << llendl;
		return;
	}
	LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL;

	LLSD identifier = credential->getIdentifier();
	if((std::string)identifier["type"] == "agent") 
	{
		std::string firstname = identifier["first_name"].asString();
		std::string lastname = identifier["last_name"].asString();
	    std::string login_id = firstname;
	    if (!lastname.empty() && lastname != "Resident")
	    {
		    // support traditional First Last name SLURLs
		    login_id += " ";
		    login_id += lastname;
	    }
		sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id);	
	}
	else if((std::string)identifier["type"] == "account")
	{
		sInstance->getChild<LLComboBox>("username_combo")->setLabel((std::string)identifier["account_name"]);		
	}
	else
	{
	  sInstance->getChild<LLComboBox>("username_combo")->setLabel(std::string());	
	}
	sInstance->addFavoritesToStartLocation();
	// if the password exists in the credential, set the password field with
	// a filler to get some stars
	LLSD authenticator = credential->getAuthenticator();
	LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
	if(authenticator.isMap() && 
	   authenticator.has("secret") && 
	   (authenticator["secret"].asString().size() > 0))
	{
		
		// This is a MD5 hex digest of a password.
		// We don't actually use the password input field, 
		// fill it with MAX_PASSWORD characters so we get a 
		// nice row of asterixes.
		const std::string filler("123456789!123456");
		sInstance->getChild<LLUICtrl>("password_edit")->setValue(std::string("123456789!123456"));
	}
	else
	{
		sInstance->getChild<LLUICtrl>("password_edit")->setValue(std::string());		
	}
	sInstance->getChild<LLUICtrl>("remember_check")->setValue(remember);
}
// Save the credential to the credential store.  Save the authenticator also if requested.
// That feature is used to implement the 'remember password' functionality.
void LLSecAPIBasicHandler::saveCredential(LLPointer<LLCredential> cred, bool save_authenticator)
{
	LLSD credential = LLSD::emptyMap();
	credential["identifier"] = cred->getIdentifier(); 
	if (save_authenticator) 
	{
		credential["authenticator"] = cred->getAuthenticator();
	}
	LL_DEBUGS("SECAPI") << "Saving Credential " << cred->getGrid() << ":" << cred->userID() << " " << save_authenticator << LL_ENDL;
	setProtectedData("credential", cred->getGrid(), credential);
	//*TODO: If we're saving Agni credentials, should we write the
	// credentials to the legacy password.dat/etc?
	_writeProtectedData();
}
// static
void FSPanelLogin::setFields(LLPointer<LLCredential> credential, bool from_startup /* = false*/)
{
	if (!sInstance)
	{
		LL_WARNS() << "Attempted setFields with no login view shown" << LL_ENDL;
		return;
	}
	LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL;

	std::string login_id;
	LLSD identifier = credential->getIdentifier();
	if (identifier["type"].asString() == "agent")
	{
		std::string firstname = identifier["first_name"].asString();
		std::string lastname = identifier["last_name"].asString();
		login_id = firstname;
		if (!lastname.empty() && lastname != "Resident")
		{
			// support traditional First Last name SLURLs
			login_id += " ";
			login_id += lastname;
		}
	}

	const std::string cred_name = credential->getCredentialName();
	LLComboBox* username_combo = sInstance->getChild<LLComboBox>("username_combo");
	if (!username_combo->selectByValue(cred_name))
	{
		username_combo->setTextEntry(login_id);
		sInstance->mPasswordModified = TRUE;
		sInstance->getChild<LLButton>("remove_user_btn")->setEnabled(FALSE);
	}
	sInstance->mPreviousUsername = username_combo->getValue().asString();
	sInstance->addFavoritesToStartLocation();
	// if the password exists in the credential, set the password field with
	// a filler to get some stars
	LLSD authenticator = credential->getAuthenticator();
	LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
	bool remember;
	if (authenticator.isMap() &&
	   authenticator.has("secret") &&
	   (authenticator["secret"].asString().size() > 0))
	{
		
		// This is a MD5 hex digest of a password.
		// We don't actually use the password input field, 
		// fill it with MAX_PASSWORD_SL characters so we get a 
		// nice row of asterixes.
		const std::string filler("123456789!123456");
		sInstance->getChild<LLLineEditor>("password_edit")->setText(filler);
		remember = true;

		// We run into this case, if a user tries to login with a newly entered password
		// and the login fails with some error (except wrong credentials). In that case,
		// LLStartUp will bring us back here and provide us with the credentials that were
		// used for the login. In case we don't have credentials already saved for this
		// username OR the password hash is different, we have to set the password back
		// to the one the user entered or we will end up trying to login with the filler
		// as password!
		if (from_startup)
		{
			LLPointer<LLCredential> stored_credential = gSecAPIHandler->loadCredential(cred_name);
			if (stored_credential->getAuthenticator().size() == 0 ||
				(stored_credential->getAuthenticator().has("secret") && stored_credential->getAuthenticator()["secret"].asString() != authenticator["secret"].asString()))
			{
				sInstance->getChild<LLLineEditor>("password_edit")->setText(sPassword);
				sInstance->mPasswordModified = TRUE;
			}
		}
	}
	else
	{
		sInstance->getChild<LLLineEditor>("password_edit")->clear();
		remember = false;
	}
	if (from_startup)
	{
		remember = gSavedSettings.getBOOL("RememberPassword");
	}
	sInstance->getChild<LLUICtrl>("remember_check")->setValue(remember);
}
示例#5
0
// static
void LLPanelLogin::setFields(LLPointer<LLCredential> credential)
{
	if (!sInstance)
	{
		llwarns << "Attempted fillFields with no login view shown" << llendl;
		return;
	}

	
	LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL;

	LLSD identifier = credential->getIdentifier();
	if((std::string)identifier["type"] == "agent") 
	{
		std::string firstname = identifier["first_name"].asString();
		std::string lastname = identifier["last_name"].asString();
	    std::string login_id = firstname;
	    if (!lastname.empty() && lastname != "Resident")
	    {
		    // support traditional First Last name SLURLs
		    login_id += " ";
		    login_id += lastname;
	    }
	}
	std::string credName = credential->getCredentialName();
	sInstance->getChild<LLComboBox>("username_combo")->selectByValue(credName);
	


// <FS:AW FIRE-6492 Firestorm doesn't always honor the start location option>
/*	if(identifier.has("startlocation")){
		llinfos << "Settings startlocation to: " << identifier["startlocation"].asString() << llendl;
		LLStartUp::setStartSLURL(LLSLURL(identifier["startlocation"].asString()));
		updateLocationCombo(false);
	}
*/
// </FS:AW FIRE-6492 Firestorm doesn't always honor the start location option>
	sInstance->addFavoritesToStartLocation();
	// if the password exists in the credential, set the password field with
	// a filler to get some stars
	LLSD authenticator = credential->getAuthenticator();
	LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
	bool remember;
	if(authenticator.isMap() && 
	   authenticator.has("secret") && 
	   (authenticator["secret"].asString().size() > 0))
	{
		
		// This is a MD5 hex digest of a password.
		// We don't actually use the password input field, 
		// fill it with MAX_PASSWORD characters so we get a 
		// nice row of asterixes.
		const std::string filler("123456789!123456");
		sInstance->getChild<LLUICtrl>("password_edit")->setValue(std::string("123456789!123456"));
		remember=true;
	}
	else
	{
		sInstance->getChild<LLUICtrl>("password_edit")->setValue(std::string());	
		remember=false;
	}
	sInstance->getChild<LLUICtrl>("remember_check")->setValue(remember);


		U32 arobase = credName.find("@");
	if (arobase != -1 && arobase +1 < credName.length())
		credName = credName.substr(arobase+1, credName.length() - arobase - 1);
// <SA: opensim>
	if(LLGridManager::getInstance()->getGrid() == credName)
	{
		return;
	}

	try
	{
		LLGridManager::getInstance()->setGridChoice(credName);
	}
	catch (LLInvalidGridName ex)
	{
		// do nothing
	}
// </SA: opensim>
	//updateServerCombo();	
	// grid changed so show new splash screen (possibly)
	updateServer();
	updateLoginPanelLinks();
	sInstance->addFavoritesToStartLocation();
	
}