Login, NFCWaiter

This commit is contained in:
2025-03-24 14:02:25 +01:00
parent d55dee91e9
commit ebe33abf69
11 changed files with 308 additions and 62 deletions
@@ -1,27 +1,69 @@
<?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"
xmlns:dx="http://schemas.devexpress.com/maui"
x:Class="WorkFlowCheck.MAUI.Pages.Security.LoginPage"
Title="Bejelentkezés"
>
<StackLayout Padding="20" VerticalOptions="Center">
<Entry x:Name="UsernameEntry" Placeholder="Felhasználói név" />
<Entry x:Name="PasswordEntry" Placeholder="PIN kód" IsPassword="True" Keyboard="Numeric"/>
<!--<dx:PasswordEdit
Text="{Binding Password, Mode=TwoWay}"
HasError="{Binding PasswordHasError}"
LabelText="Password"
HelpText="*Required"
Keyboard="Numeric"
ErrorText="The password should contain more than 5 characters,
have at least one uppercase and one lowercase letter, and one number."
PlaceholderText="Enter password"/>-->
<Button x:Name="LoginBtn" Text="Bejelentkezés" Clicked="OnLoginClicked" />
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
VerticalOptions="Center"
HorizontalOptions="Center" />
</StackLayout>
</ContentPage>
BackgroundColor="#f0f0f0">
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Középen lévő kártya, ami mobilon is jól mutat, tableten pedig középen marad -->
<Frame Grid.Row="1"
BackgroundColor="White"
BorderColor="#cccccc"
CornerRadius="20"
Padding="30"
HasShadow="True"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="{OnPlatform Android=350, iOS=350, WinUI=400, MacCatalyst=400}"
MaximumWidthRequest="500">
<VerticalStackLayout Spacing="20">
<Label Text="Bejelentkezés"
FontSize="24"
FontAttributes="Bold"
HorizontalOptions="Center"
TextColor="#333" />
<Entry x:Name="UsernameEntry"
Placeholder="Felhasználói név"
FontSize="18"
BackgroundColor="#f9f9f9"
HeightRequest="50"
Margin="0" />
<Entry x:Name="PasswordEntry"
Placeholder="PIN kód"
IsPassword="True"
Keyboard="Numeric"
FontSize="18"
BackgroundColor="#f9f9f9"
HeightRequest="50"
Margin="0" />
<Button x:Name="LoginBtn"
Text="Bejelentkezés"
FontSize="18"
HeightRequest="50"
CornerRadius="10"
BackgroundColor="#007aff"
TextColor="White"
Clicked="OnLoginClicked" />
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
HorizontalOptions="Center" />
</VerticalStackLayout>
</Frame>
</Grid>
</ScrollView>
</ContentPage>
@@ -5,10 +5,12 @@ namespace WorkFlowCheck.MAUI.Pages.Security;
public partial class LoginPage : ContentPage
{
private IUserService _userService;
private ISyncService _syncService;
public LoginPage()
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
}
private async void OnLoginClicked(object sender, EventArgs e)
{
@@ -24,6 +26,7 @@ public partial class LoginPage : ContentPage
if (response != null && response.IsSuccess)
{
_userService.SetCurrentUser(response.Data);
await _syncService.SyncDatas();
var wFCUser = Newtonsoft.Json.JsonConvert.SerializeObject(response.Data);
await SecureStorage.Default.SetAsync("WFCUser", "wFCUser");