diff --git a/lib/Constants.dart b/lib/Constants.dart index 9023170..7a33e80 100644 --- a/lib/Constants.dart +++ b/lib/Constants.dart @@ -8,7 +8,7 @@ class Constants { static const DRAWER_COLOR = Color.fromARGB(148, 0, 97, 97); static const PORTFOLIO_CARD_COLOR = Color.fromARGB(255, 0, 71, 97); - static const VERSION = "Version 1.0.051624.0201"; + static const VERSION = "Version 1.0.051624.0352"; static const COPYRIGHT = "Copyright 2024 - Tara Piccari. All rights Reserved"; static const CLIENTPSK = "f5c6caf3efe1ec5aa4b7c572f92aa14782b7be34b4c7844fa9c6d47fdf94246"; diff --git a/lib/Settings.dart b/lib/Settings.dart index b1350a2..d828efc 100644 --- a/lib/Settings.dart +++ b/lib/Settings.dart @@ -11,6 +11,7 @@ enum APIEndpoint { Ping(script: "Ping.php", path: "/ac/home/supports/"), Setup(script: "Setup.php", path: "/ac/home/supports/"), Register(script: "Register.php", path: "/ac/home/supports/"), + Logout(script: "Logout.php", path: "/ac/home/supports/"), Login(script: "Login.php", path: "/ac/home/supports/"); final String script; diff --git a/lib/pages/OpenSim.dart b/lib/pages/OpenSim.dart index e3ebbc1..63343a9 100644 --- a/lib/pages/OpenSim.dart +++ b/lib/pages/OpenSim.dart @@ -113,12 +113,24 @@ class OpenSimPageState extends State { ), ), ListTile( - title: Text(settings.loggedIn - ? "Welcome, ${settings.displayName}" - : "You are not currently logged in"), + title: Text( + settings.loggedIn + ? "Welcome, ${settings.displayName}" + : "You are not currently logged in", + ), ), settings.loggedIn - ? SizedBox() + ? Column( + children: [ + ElevatedButton( + onPressed: () async { + settings.loggedIn = false; + await settings.sendPacketToEndpoint( + APIEndpoint.Logout, NullPacket()); + }, + child: Text("LOGOUT")) + ], + ) : Center( child: Row( children: [ diff --git a/php/Login.php b/php/Login.php index 8238606..6149940 100644 --- a/php/Login.php +++ b/php/Login.php @@ -15,7 +15,7 @@ $password = $js["password"]; $DB = get_DB(); $id = NULLKEY; -$rezday = 0; +$rez = 0; $title = ""; $login = false; $reason = "Unauthorized"; @@ -26,19 +26,6 @@ if($clientKey == CLIENTPSK) { // PSK Matches, authorized application $res = $DB->query("SELECT * FROM `UserAccounts` INNER JOIN `auth` ON `UserAccounts`.`PrincipalID` = `auth`.`UUID` WHERE `FirstName` = '$first' AND `LastName` = '$last';"); -/* - * - return User( - ID: UUID.parse(map['id'] as String), - FirstName: map['first'] as String, - LastName: map['last'] as String, - createdAt: map['rezzed'] as int, - userTitle: map['title'] as String); - return S2CLoginResponsePacket( - loggedIn: map['login'] as bool, - reason: map['reason'] as String, - user: User.parseJson(json.encode(map['user']))); - */ if($res->num_rows > 0) { $row = $res->fetch_assoc(); @@ -51,7 +38,7 @@ if($clientKey == CLIENTPSK) { $id = $row['UUID']; $first = $row['FirstName']; $last = $row['LastName']; - $rezday = $row['createdAt']; + $rez = (int)$row['createdAt']; $title = $row['UserTitle']; $active = $row['active'] == 1; @@ -77,7 +64,7 @@ die(json_encode( "first" => $first, "last" => $last, "title" => $title, - "rez" => $rezday, + "rez" => $rez, "active" => $active ) ) diff --git a/php/Logout.php b/php/Logout.php new file mode 100644 index 0000000..d66278a --- /dev/null +++ b/php/Logout.php @@ -0,0 +1,12 @@ + true, + "type" => "S2CSimpleReply" +))); + +?> \ No newline at end of file