From 132c85c1fd87bffff546f3933790bc69da844244 Mon Sep 17 00:00:00 2001 From: inportb Date: Tue, 25 Apr 2023 19:42:00 -0400 Subject: [PATCH] Better SSO login experience --- rpc.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rpc.py b/rpc.py index 4e04347..d3deba6 100644 --- a/rpc.py +++ b/rpc.py @@ -140,7 +140,10 @@ class ClientSync(object): return res def authenticate(self, identity: str, *, context=('XUS SIGNON',)): self._server.update(RecordServerInfo(*self('XUS SIGNON SETUP', '', '1', context=context))._asdict()) - res = self('XUS AV CODE', XWBHash_encrypt(identity)) + if identity.startswith(''): + res = self('XUS ESSO VALIDATE', RPCType(tuple(identity[i:i+200] for i in range(0, len(identity), 200)), RPCType.GLOBAL)) + else: + res = self('XUS AV CODE', XWBHash_encrypt(identity)) if res[0] == '0' or res[2] != '0': raise RPCExcAuth(res[3], res) self._user = res @@ -217,7 +220,10 @@ class ClientAsync(object): return res async def authenticate(self, identity: str, *, context=('XUS SIGNON',)): self._server.update(RecordServerInfo(*await self('XUS SIGNON SETUP', '', '1', context=context))._asdict()) - res = await self('XUS AV CODE', XWBHash_encrypt(identity)) + if identity.startswith(''): + res = await self('XUS ESSO VALIDATE', RPCType(tuple(identity[i:i+200] for i in range(0, len(identity), 200)), RPCType.GLOBAL)) + else: + res = await self('XUS AV CODE', XWBHash_encrypt(identity)) if res[0] == '0' or res[2] != '0': raise RPCExcAuth(res[3], res) self._user = res