POST-os hívás tesztje az authentikációhoz

This commit is contained in:
2025-01-21 16:21:48 +01:00
parent 177aa668a6
commit 862f0a148b
8 changed files with 82 additions and 14 deletions
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.Security.LoginPage"
Title="LoginPage">
<StackLayout Padding="20" VerticalOptions="Center">
<Entry x:Name="UsernameEntry" Placeholder="Username" />
<Entry x:Name="PasswordEntry" Placeholder="Password" IsPassword="True" />
<Button Text="Log In" Clicked="OnLoginClicked" />
</StackLayout>
</ContentPage>
@@ -0,0 +1,30 @@
using WorkFlowCheck.MAUI.Services;
namespace WorkFlowCheck.MAUI.Pages.Security;
public partial class LoginPage : ContentPage
{
private readonly IUserService _userService;
public LoginPage(IUserService userService)
{
InitializeComponent();
_userService = userService;
}
private async void OnLoginClicked(object sender, EventArgs e)
{
// Példa bejelentkezés
bool success = _userService.Login(UsernameEntry.Text, PasswordEntry.Text);
if (success)
{
await DisplayAlert("Success", "You are now logged in.", "OK");
// Visszatérés a MainPage-re
await Navigation.PopAsync();
}
else
{
await DisplayAlert("Error", "Invalid login credentials.", "OK");
}
}
}