From 55b0ff1c458f41361938faed69d688a34111d2c8 Mon Sep 17 00:00:00 2001 From: WeeXnes Date: Tue, 21 Nov 2023 21:02:39 +0100 Subject: [PATCH] fully implemented login --- WeeXnes/Core/Global.cs | 2 +- WeeXnes/Core/HandleLaunchArguments.cs | 2 +- WeeXnes/Core/LoginLib.cs | 6 +++ WeeXnes/MainWindow.xaml | 4 +- WeeXnes/Views/ProfileView/LoginError.xaml | 15 +++++++ WeeXnes/Views/ProfileView/LoginError.xaml.cs | 19 +++++++++ WeeXnes/Views/ProfileView/LoginView.xaml | 11 +++++- WeeXnes/Views/ProfileView/LoginView.xaml.cs | 39 ++++++++++++++++++- WeeXnes/Views/ProfileView/ProfileView.xaml.cs | 20 ++++++++-- WeeXnes/WeeXnes.csproj | 6 ++- 10 files changed, 112 insertions(+), 12 deletions(-) create mode 100644 WeeXnes/Views/ProfileView/LoginError.xaml create mode 100644 WeeXnes/Views/ProfileView/LoginError.xaml.cs diff --git a/WeeXnes/Core/Global.cs b/WeeXnes/Core/Global.cs index afcf1e5..cc77607 100644 --- a/WeeXnes/Core/Global.cs +++ b/WeeXnes/Core/Global.cs @@ -8,7 +8,7 @@ namespace WeeXnes.Core { public class Information { - public const string Version = "4.4.7"; + public const string Version = "4.4.8"; public const string EncryptionHash = "8zf5#RdyQ]$4x4_"; public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest"; } diff --git a/WeeXnes/Core/HandleLaunchArguments.cs b/WeeXnes/Core/HandleLaunchArguments.cs index ce7b854..ee7ef4e 100644 --- a/WeeXnes/Core/HandleLaunchArguments.cs +++ b/WeeXnes/Core/HandleLaunchArguments.cs @@ -19,7 +19,7 @@ namespace WeeXnes.Core } public static void arg_debugMode() { - + MessageBox.Show("user debug mode enabled"); } public static void arg_enableConsole() { diff --git a/WeeXnes/Core/LoginLib.cs b/WeeXnes/Core/LoginLib.cs index 2ce5816..eef87ea 100644 --- a/WeeXnes/Core/LoginLib.cs +++ b/WeeXnes/Core/LoginLib.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Net.Http; using Newtonsoft.Json; +using WeeXnes.Views.ProfileView; using WeeXnes.Views.Settings; using Wpf.Ui.Appearance; using Wpf.Ui.Controls; @@ -73,10 +74,12 @@ namespace WeeXnes.Core _token = token; return token; //Console.WriteLine($"Token: {token}"); + } else { WeeXnes.Core.CustomConsole.WriteLine("Error: " + response.StatusCode); + LoginView.errorStringCache.Value = response.StatusCode.ToString(); return null; } } @@ -116,6 +119,7 @@ namespace WeeXnes.Core //Console.WriteLine($"Email: {user.email}"); // Access other properties as needed _currentUserCache.Value = user; + LoginView.alreadyLoggedIn = true; return user; } else @@ -124,6 +128,8 @@ namespace WeeXnes.Core _currentUserCache.Value = null; WeeXnes.Core.CustomConsole.WriteLine("Error: " + response.StatusCode); + + LoginView.errorStringCache.Value = response.StatusCode.ToString(); return null; } } diff --git a/WeeXnes/MainWindow.xaml b/WeeXnes/MainWindow.xaml index 4d88545..fac605e 100644 --- a/WeeXnes/MainWindow.xaml +++ b/WeeXnes/MainWindow.xaml @@ -91,13 +91,13 @@ Name="ButtonPwGen" PageTag="Gen" PageType="{x:Type passwordGenerator:PasswordGenView}"/> - + PageType="{x:Type profile:LoginView}"/> + + +