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; Username = Settings.Default.Username;
RememberUser = Settings.Default.RememberMe; RememberUser = Settings.Default.RememberMe;
} }
AutoLoginAsync();
} }
public ICommand LoginCommand { get; set; } public ICommand LoginCommand { get; set; }
private async void LoginAsync(object parameter) { private async void LoginAsync(object parameter) {
if (!String.IsNullOrWhiteSpace(Username) && !String.IsNullOrWhiteSpace((parameter as IHavePassword).SecurePassword.Unsecure())) { 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"; 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"; Loading = "Hidden";
switch (result) { switch (result) {
case 0: case 0:
@@ -123,5 +120,19 @@ namespace Server_Dashboard {
} }
ErrorText = ""; 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> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@@ -41,42 +40,47 @@ using System.Windows.Shell;
namespace Server_Dashboard { namespace Server_Dashboard {
/// <summary> /// <summary>
/// LoginWindow /// LoginWindow
/// </summary> /// </summary>
public partial class LoginWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector { public partial class LoginWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
#line default
#line hidden #line 9 "..\..\..\LoginWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal Server_Dashboard.LoginWindow Login;
#line 130 "..\..\..\LoginWindow.xaml"
#line default
#line hidden
#line 130 "..\..\..\LoginWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBox UserName; internal System.Windows.Controls.TextBox UserName;
#line default #line default
#line hidden #line hidden
#line 174 "..\..\..\LoginWindow.xaml" #line 174 "..\..\..\LoginWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.PasswordBox Password; internal System.Windows.Controls.PasswordBox Password;
#line default #line default
#line hidden #line hidden
#line 185 "..\..\..\LoginWindow.xaml" #line 185 "..\..\..\LoginWindow.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBlock PasswordHint; internal System.Windows.Controls.TextBlock PasswordHint;
#line default #line default
#line hidden #line hidden
private bool _contentLoaded; private bool _contentLoaded;
/// <summary> /// <summary>
/// InitializeComponent /// InitializeComponent
/// </summary> /// </summary>
@@ -88,21 +92,21 @@ namespace Server_Dashboard {
} }
_contentLoaded = true; _contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/Server Dashboard;component/loginwindow.xaml", System.UriKind.Relative); System.Uri resourceLocater = new System.Uri("/Server Dashboard;component/loginwindow.xaml", System.UriKind.Relative);
#line 1 "..\..\..\LoginWindow.xaml" #line 1 "..\..\..\LoginWindow.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater); System.Windows.Application.LoadComponent(this, resourceLocater);
#line default #line default
#line hidden #line hidden
} }
[System.Diagnostics.DebuggerNonUserCodeAttribute()] [System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "5.0.4.0")] [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "5.0.4.0")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal System.Delegate _CreateDelegate(System.Type delegateType, string handler) { internal System.Delegate _CreateDelegate(System.Type delegateType, string handler) {
return System.Delegate.CreateDelegate(delegateType, this, handler); return System.Delegate.CreateDelegate(delegateType, this, handler);
} }
[System.Diagnostics.DebuggerNonUserCodeAttribute()] [System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "5.0.4.0")] [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "5.0.4.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
@@ -110,24 +114,23 @@ namespace Server_Dashboard {
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId) { switch (connectionId)
case 1: {
this.Login = ((Server_Dashboard.LoginWindow)(target)); case 1:
return; this.Login = ((Server_Dashboard.LoginWindow)(target));
case 2: return;
this.UserName = ((System.Windows.Controls.TextBox)(target)); case 2:
return; this.UserName = ((System.Windows.Controls.TextBox)(target));
case 3: return;
this.Password = ((System.Windows.Controls.PasswordBox)(target)); case 3:
return; this.Password = ((System.Windows.Controls.PasswordBox)(target));
case 4: return;
this.PasswordHint = ((System.Windows.Controls.TextBlock)(target)); case 4:
return; this.PasswordHint = ((System.Windows.Controls.TextBlock)(target));
return;
} }
this._contentLoaded = true; 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 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; 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;;