diff --git a/src/WorkFlowCheck.MAUI/MainPage.xaml b/src/WorkFlowCheck.MAUI/MainPage.xaml
index 2377a26..40ecfb1 100644
--- a/src/WorkFlowCheck.MAUI/MainPage.xaml
+++ b/src/WorkFlowCheck.MAUI/MainPage.xaml
@@ -43,6 +43,12 @@
SemanticProperties.Hint="Test NFC capability"
Clicked="OnButtonNFCTest"
HorizontalOptions="Fill" />
+
diff --git a/src/WorkFlowCheck.MAUI/MainPage.xaml.cs b/src/WorkFlowCheck.MAUI/MainPage.xaml.cs
index 44ece58..8391fab 100644
--- a/src/WorkFlowCheck.MAUI/MainPage.xaml.cs
+++ b/src/WorkFlowCheck.MAUI/MainPage.xaml.cs
@@ -48,6 +48,11 @@ namespace WorkFlowCheck.MAUI
{
await Shell.Current.GoToAsync("//NFCTestPage");
}
+ private void OnButtonLogout(object sender, EventArgs e)
+ {
+ SecureStorage.Default.Remove("WFCUser");
+ Shell.Current.GoToAsync("//LoginPage");
+ }
}
}
diff --git a/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml b/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml
index f715f96..e17660a 100644
--- a/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml
+++ b/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml
@@ -5,7 +5,7 @@
Title="NFCTestPage">
diff --git a/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml b/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml
index 2722b98..761c1f2 100644
--- a/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml
+++ b/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml
@@ -5,7 +5,12 @@
Title="LoginPage">
-
-
+
+
+
\ No newline at end of file
diff --git a/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml.cs
index 0de37b0..6e31e3a 100644
--- a/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml.cs
+++ b/src/WorkFlowCheck.MAUI/Pages/Security/LoginPage.xaml.cs
@@ -13,19 +13,42 @@ public partial class LoginPage : ContentPage
}
private async void OnLoginClicked(object sender, EventArgs e)
{
- // Példa bejelentkezés
- var response = await _userService.Authenticate(UsernameEntry.Text.ToString(), PasswordEntry.Text.ToString());
-
- if (response != null && response.IsSuccess)
+ LoadingIndicator.IsRunning = true;
+ LoadingIndicator.IsVisible = true;
+ LoginBtn.IsEnabled = false;
+ UsernameEntry.IsEnabled = false;
+ PasswordEntry.IsEnabled = false;
+ try
{
- await DisplayAlert("Success", "You are now logged in.", "OK");
+ var response = await _userService.Authenticate(UsernameEntry.Text.ToString(), PasswordEntry.Text.ToString());
- // Visszatérés a MainPage-re
- await Shell.Current.GoToAsync("//MainPage");
+ if (response != null && response.IsSuccess)
+ {
+
+ var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data);
+ await SecureStorage.Default.SetAsync("WFCUser", "wFCUser");
+
+ await Shell.Current.GoToAsync("//MainPage");
+ }
+ else
+ {
+ await DisplayAlert("Error", "Invalid login credentials.", "OK");
+ }
}
- else
+ catch (Exception)
{
- await DisplayAlert("Error", "Invalid login credentials.", "OK");
+
+ throw;
}
+ finally
+ {
+ LoginBtn.IsEnabled = true;
+ LoadingIndicator.IsRunning = false;
+ LoadingIndicator.IsVisible = false;
+ UsernameEntry.IsEnabled = true;
+ PasswordEntry.IsEnabled = true;
+
+ }
+
}
}
\ No newline at end of file