diff --git a/lib/pages/OpenSim.dart b/lib/pages/OpenSim.dart index e72aa99..7db72ad 100644 --- a/lib/pages/OpenSim.dart +++ b/lib/pages/OpenSim.dart @@ -154,11 +154,19 @@ class OpenSimPageState extends State { if (settings.loggedIn && !settings.currentUser!.active && !activating) { activating = true; - showDialog( + await showDialog( context: context, builder: (B) { return CreateInventoryPopup(); }); + activating = false; + // Force user to re-login + SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.clear(); + setState(() { + settings.loggedIn = false; + settings.currentUser = null; + }); } } @@ -210,15 +218,16 @@ class OpenSimPageState extends State { ElevatedButton( onPressed: () async { settings.loggedIn = false; + + var loginToken = settings + .currentUser!.loginToken; settings.currentUser = null; await settings .sendPacketToEndpoint( APIEndpoint.Logout, C2SLogoutPacket( - ID: settings - .currentUser! - .loginToken)); + ID: loginToken)); SharedPreferences prefs = await SharedPreferences