Paused autologin for now, pick up later

This commit is contained in:
Rene Schwarz
2021-08-06 10:40:08 +02:00
parent f306e329ae
commit 08d08280b9
11 changed files with 80 additions and 55 deletions

Binary file not shown.

View File

@@ -60,18 +60,15 @@ namespace Server_Dashboard {
Username = Settings.Default.Username;
RememberUser = Settings.Default.RememberMe;
}
AutoLoginAsync();
}
public ICommand LoginCommand { get; set; }
private async void LoginAsync(object parameter) {
if (!String.IsNullOrWhiteSpace(Username) && !String.IsNullOrWhiteSpace((parameter as IHavePassword).SecurePassword.Unsecure())) {
int result = 0;
if (RememberUser && !String.IsNullOrEmpty(Settings.Default.Username) && !String.IsNullOrEmpty(Settings.Default.Cookies) && Settings.Default.Password.Length == 6) {
result = await Task.Run(() => DatabaseHandler.CheckCookie(Settings.Default.Cookies, Username));
}
Loading = "Visible";
result = await Task.Run(() => DatabaseHandler.CheckLogin(Username, (parameter as IHavePassword).SecurePassword.Unsecure()));
int result = await Task.Run(() => DatabaseHandler.CheckLogin(Username, (parameter as IHavePassword).SecurePassword.Unsecure()));
Loading = "Hidden";
switch (result) {
case 0:
@@ -123,5 +120,19 @@ namespace Server_Dashboard {
}
ErrorText = "";
}
//TODO: Add autologin function that locks the UI untill the user hits the abort button or the login completes
/*private async void AutoLoginAsync() {
if (Settings.Default.RememberMe && !String.IsNullOrEmpty(Settings.Default.Username) && !String.IsNullOrEmpty(Settings.Default.Cookies)) {
Loading = "Visible";
int result = await Task.Run(() => DatabaseHandler.CheckCookie(Settings.Default.Cookies, Username));
Loading = "Hidden";
if (result == 1) {
DashboardWindow window = new DashboardWindow();
window.Show();
Close?.Invoke();
return;
}
}
}*/
}
}

View File

@@ -1,5 +1,4 @@
// Updated by XamlIntelliSenseFileGenerator 05.08.2021 22:10:48
#pragma checksum "..\..\..\LoginWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "BC333A5F7B9E8D68E824FFFBFE4539E4AA85365F"
#pragma checksum "..\..\..\LoginWindow.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "BC333A5F7B9E8D68E824FFFBFE4539E4AA85365F"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@@ -48,6 +47,11 @@ namespace Server_Dashboard {
/// </summary>
public partial class LoginWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
#line 9 "..\..\..\LoginWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal Server_Dashboard.LoginWindow Login;
#line default
#line hidden
@@ -110,7 +114,8 @@ namespace Server_Dashboard {
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId) {
switch (connectionId)
{
case 1:
this.Login = ((Server_Dashboard.LoginWindow)(target));
return;
@@ -126,8 +131,6 @@ namespace Server_Dashboard {
}
this._contentLoaded = true;
}
internal System.Windows.Window Login;
}
}

View File

@@ -16,5 +16,5 @@ C:\Users\Crylia\Documents\Git\Server Dashboard\Server Dashboard\App.xaml
2061472260849
Controls\Dashboard\CRUD Popup\CreateModulePopup.xaml;Controls\DoubleRoundProgressBar\DoubleRoundProgressBar.xaml;Controls\HalfRoundProgressBar\HalfRoundProgressBar.xaml;Controls\LoadingIndicator\LoadingIndicator.xaml;Controls\ServerModules\ServerModule.xaml;LoginWindow.xaml;Views\DashboardPages\MainDashboardPage.xaml;Views\DashboardWindow.xaml;
False
True

View File

@@ -0,0 +1,11 @@
C:\Users\Crylia\Documents\Git\Server Dashboard\Server Dashboard\obj\Debug\netcoreapp3.1\GeneratedInternalTypeHelper.g.i.cs
FC:\Users\Crylia\Documents\Git\Server Dashboard\Server Dashboard\App.xaml;;
FC:\Users\Crylia\Documents\Git\Server Dashboard\Server Dashboard\Controls\Dashboard\CRUD Popup\CreateModulePopup.xaml;;
FC:\Users\Crylia\Documents\Git\Server Dashboard\Server Dashboard\Controls\DoubleRoundProgressBar\DoubleRoundProgressBar.xaml;;
FC:\Users\Crylia\Documents\Git\Server Dashboard\Server Dashboard\Controls\HalfRoundProgressBar\HalfRoundProgressBar.xaml;;
FC:\Users\Crylia\Documents\Git\Server Dashboard\Server Dashboard\Controls\LoadingIndicator\LoadingIndicator.xaml;;
FC:\Users\Crylia\Documents\Git\Server Dashboard\Server Dashboard\Controls\ServerModules\ServerModule.xaml;;
FC:\Users\Crylia\Documents\Git\Server Dashboard\Server Dashboard\LoginWindow.xaml;;
FC:\Users\Crylia\Documents\Git\Server Dashboard\Server Dashboard\Views\DashboardPages\MainDashboardPage.xaml;;
FC:\Users\Crylia\Documents\Git\Server Dashboard\Server Dashboard\Views\DashboardWindow.xaml;;