summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpanelloginlistener.cpp22
-rw-r--r--indra/newview/scripts/lua/require/login.lua23
-rw-r--r--indra/newview/scripts/lua/test_login.lua9
3 files changed, 48 insertions, 6 deletions
diff --git a/indra/newview/llpanelloginlistener.cpp b/indra/newview/llpanelloginlistener.cpp
index a4418145d7..aeaf2d1d00 100644
--- a/indra/newview/llpanelloginlistener.cpp
+++ b/indra/newview/llpanelloginlistener.cpp
@@ -72,6 +72,23 @@ void LLPanelLoginListener::onClickConnect(const LLSD&) const
mPanel->onClickConnect(false);
}
+namespace
+{
+
+ std::string gridkey(const std::string& grid)
+ {
+ if (grid.find('.') != std::string::npos)
+ {
+ return grid;
+ }
+ else
+ {
+ return stringize("util.", grid, ".lindenlab.com");
+ }
+ }
+
+} // anonymous namespace
+
void LLPanelLoginListener::login(const LLSD& args) const
{
// Although we require a "reply" key, don't instantiate a Response object:
@@ -97,6 +114,7 @@ void LLPanelLoginListener::login(const LLSD& args) const
auto& gridmgr{ LLGridManager::instance() };
if (! grid.empty())
{
+ grid = gridkey(grid);
// setGridChoice() can throw LLInvalidGridName -- but if so, let it
// propagate, trusting that LLEventAPI will catch it and send an
// appropriate reply.
@@ -202,7 +220,7 @@ void LLPanelLoginListener::login(const LLSD& args) const
LLSD LLPanelLoginListener::savedLogins(const LLSD& args) const
{
LL_INFOS() << "called with " << args << LL_ENDL;
- std::string grid = (args.has("grid")? args["grid"].asString()
+ std::string grid = (args.has("grid")? gridkey(args["grid"].asString())
: LLGridManager::instance().getGrid());
if (! gSecAPIHandler->hasCredentialMap("login_list", grid))
{
@@ -211,7 +229,7 @@ LLSD LLPanelLoginListener::savedLogins(const LLSD& args) const
stringize("No saved logins for grid ", std::quoted(grid)));
}
LLSecAPIHandler::credential_map_t creds;
- gSecAPIHandler->loadCredentialMap("login.list", grid, creds);
+ gSecAPIHandler->loadCredentialMap("login_list", grid, creds);
auto result = llsd::map(
"logins",
llsd::toArray(
diff --git a/indra/newview/scripts/lua/require/login.lua b/indra/newview/scripts/lua/require/login.lua
index f4e65b1606..50fc9e3793 100644
--- a/indra/newview/scripts/lua/require/login.lua
+++ b/indra/newview/scripts/lua/require/login.lua
@@ -2,11 +2,32 @@ local leap = require 'leap'
local startup = require 'startup'
local mapargs = require 'mapargs'
-local function login(...)
+local login = {}
+
+local function ensure_login_state(op)
+ -- no point trying to login until the viewer is ready
startup.wait('STATE_LOGIN_WAIT')
+ -- Once we've actually started login, LLPanelLogin is destroyed, and so is
+ -- its "LLPanelLogin" listener. At that point,
+ -- leap.request("LLPanelLogin", ...) will hang indefinitely because no one
+ -- is listening on that LLEventPump any more. Intercept that case and
+ -- produce a sensible error.
+ local state = startup.state()
+ if startup.before('STATE_LOGIN_WAIT', state) then
+ error(`Can't engage login operation {op} once we've reached state {state}`, 2)
+ end
+end
+
+function login.login(...)
+ ensure_login_state('login')
local args = mapargs('username,grid,slurl', ...)
args.op = 'login'
return leap.request('LLPanelLogin', args)
end
+function login.savedLogins(grid)
+ ensure_login_state('savedLogins')
+ return leap.request('LLPanelLogin', {op='savedLogins'})['logins']
+end
+
return login
diff --git a/indra/newview/scripts/lua/test_login.lua b/indra/newview/scripts/lua/test_login.lua
index f263940f79..54d3635a41 100644
--- a/indra/newview/scripts/lua/test_login.lua
+++ b/indra/newview/scripts/lua/test_login.lua
@@ -1,7 +1,10 @@
inspect = require 'inspect'
login = require 'login'
-print(inspect(login{
- username='Nat Linden',
--- grid='agni'
+local grid = 'agni'
+print(inspect(login.savedLogins(grid)))
+
+print(inspect(login.login{
+ username='Your Username',
+ grid=grid
}))