From c57d0e5b3b33ac9bf227b9186200a664e4b99b60 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Mon, 9 May 2022 21:01:38 -0400
Subject: [PATCH] Fix password length limit for SL

---
 indra/newview/llpanellogin.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index ed11e7a71f6..9510dee6bf4 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -1184,11 +1184,15 @@ void LLPanelLogin::updateServer()
 		// Not sure if it should carry over password but it worked like this before login changes
 		// Example: you started typing in and found that your are under wrong grid,
 		// you switch yet don't lose anything
+		constexpr S32 MAX_PASSWORD_SL{16};
+		constexpr S32 MAX_PASSWORD_OPENSIM{64};
+		LLLineEditor* pswd_edit = sInstance->getChild<LLLineEditor>("password_edit");
+		pswd_edit->setMaxTextChars(LLGridManager::getInstance()->isInSecondlife() ? MAX_PASSWORD_SL : MAX_PASSWORD_OPENSIM);
 		if (sInstance->areCredentialFieldsDirty())
         {
 			// save modified creds
 			LLComboBox* user_combo = sInstance->getChild<LLComboBox>("username_combo");
-			LLLineEditor* pswd_edit = sInstance->getChild<LLLineEditor>("password_edit");
+
 			std::string username = user_combo->getSimple();
 			LLStringUtil::trim(username);
 			std::string password = pswd_edit->getValue().asString();
-- 
GitLab